public class SimpleTypeCasterAnyType extends Object implements SimpleTypeCaster
Constructor and Description |
---|
SimpleTypeCasterAnyType(Class typeToCastTo)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
Object |
cast(Object object)
Casts an object to another type, typically for numeric types.
|
CodegenExpression |
codegen(CodegenExpression input,
Class inputType,
CodegenContext context) |
boolean |
isNumericCast()
Returns true to indicate that the cast target type is numeric.
|
static Object |
simpleTypeCasterCast(Object object,
Class typeToCastTo,
CopyOnWriteArraySet<Pair<Class,Boolean>> pairs)
NOTE: Code-generation-invoked method, method name and parameter order matters
|
public SimpleTypeCasterAnyType(Class typeToCastTo)
typeToCastTo
- is the target typepublic boolean isNumericCast()
SimpleTypeCaster
isNumericCast
in interface SimpleTypeCaster
public static Object simpleTypeCasterCast(Object object, Class typeToCastTo, CopyOnWriteArraySet<Pair<Class,Boolean>> pairs)
object
- to casttypeToCastTo
- targetpairs
- cachepublic Object cast(Object object)
SimpleTypeCaster
May performs a compatibility check and returns null if not compatible.
cast
in interface SimpleTypeCaster
object
- to castpublic CodegenExpression codegen(CodegenExpression input, Class inputType, CodegenContext context)
codegen
in interface SimpleTypeCaster