|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.expr.TypeConversionHelper
public class TypeConversionHelper
Constructor Summary | |
---|---|
TypeConversionHelper()
|
Method Summary | |
---|---|
static boolean |
canCastTo(TypeInfo convertedTo,
TypeInfo convertedFrom)
Find out if the type convertedFrom can be widening to
the type convertedTo . |
static boolean |
canConvert(java.lang.Class convertTo,
java.lang.Object source)
|
static boolean |
canWideningTo(TypeInfo convertedTo,
TypeInfo convertedFrom)
Find out if the type convertedFrom can be widening to
the type convertedTo . |
static java.lang.Object |
convertPrimitive(java.lang.String convertTo,
java.lang.Object source)
This method converts the source to an instance of
type convertTo if source is a primitive
and convertTo is also a primitive type. |
static java.lang.Object |
convertPrimitive(TypeInfo convertTo,
java.lang.Object source)
This method converts the source to an instance of
type convertTo if source is a primitive
and convertTo is also a primitive type. |
static boolean |
exactMatch(TypeInfo convertedTo,
TypeInfo convertedFrom)
Find out if the two types are the same. |
static java.lang.Class |
getClassForType(java.lang.String name)
|
static boolean |
isCompatible(TypeRetriever provider,
java.lang.String convertedTo,
java.lang.String convertedFrom)
Find out if the type convertedFrom is compatible with
the type convertedTo . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeConversionHelper()
Method Detail |
---|
public static boolean isCompatible(TypeRetriever provider, java.lang.String convertedTo, java.lang.String convertedFrom)
convertedFrom
is compatible with
the type convertedTo
.
provider
- convertedTo
- convertedFrom
- public static boolean canCastTo(TypeInfo convertedTo, TypeInfo convertedFrom)
convertedFrom
can be widening to
the type convertedTo
. If both are primtive types, then
this method will check if primtive narrowing is possible.
convertedTo
- convertedFrom
- public static boolean canWideningTo(TypeInfo convertedTo, TypeInfo convertedFrom)
convertedFrom
can be widening to
the type convertedTo
.
convertedTo
- convertedFrom
- public static boolean exactMatch(TypeInfo convertedTo, TypeInfo convertedFrom)
convertedTo
- convertedFrom
- public static java.lang.Object convertPrimitive(TypeInfo convertTo, java.lang.Object source)
source
to an instance of
type convertTo
if source
is a primitive
and convertTo
is also a primitive type. Otherwise,
this method return the source
withou conversion.
convertTo
- source
- public static java.lang.Object convertPrimitive(java.lang.String convertTo, java.lang.Object source)
source
to an instance of
type convertTo
if source
is a primitive
and convertTo
is also a primitive type. If the
convertTo
is a string and the convertFrom
is a character, then conversion is allowed. Otherwise,
this method return the source
without conversion.
convertTo
- source
- public static boolean canConvert(java.lang.Class convertTo, java.lang.Object source)
public static java.lang.Class getClassForType(java.lang.String name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |