public class SimpleTypeCasterAnyType extends java.lang.Object implements SimpleTypeCaster
Constructor and Description |
---|
SimpleTypeCasterAnyType(java.lang.Class typeToCastTo)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
cast(java.lang.Object object)
Casts an object to another type, typically for numeric types.
|
CodegenExpression |
codegen(CodegenExpression input,
java.lang.Class inputType,
CodegenMethodScope codegenMethodScope,
CodegenClassScope codegenClassScope) |
boolean |
isNumericCast()
Returns true to indicate that the cast target type is numeric.
|
static java.lang.Object |
simpleTypeCasterCast(java.lang.Object object,
java.lang.Class typeToCastTo,
java.util.concurrent.CopyOnWriteArraySet<Pair<java.lang.Class,java.lang.Boolean>> pairs)
NOTE: Code-generation-invoked method, method name and parameter order matters
|
public SimpleTypeCasterAnyType(java.lang.Class typeToCastTo)
typeToCastTo
- is the target typepublic boolean isNumericCast()
SimpleTypeCaster
isNumericCast
in interface SimpleTypeCaster
public static java.lang.Object simpleTypeCasterCast(java.lang.Object object, java.lang.Class typeToCastTo, java.util.concurrent.CopyOnWriteArraySet<Pair<java.lang.Class,java.lang.Boolean>> pairs)
object
- to casttypeToCastTo
- targetpairs
- cachepublic java.lang.Object cast(java.lang.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, java.lang.Class inputType, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope)
codegen
in interface SimpleTypeCaster