Class DefaultTypeTransformation
java.lang.Object
org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation
Class providing various type conversions, coercions and boxing/unboxing operations.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final Object[]protected static final BigInteger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic CollectionarrayAsCollection(Object value) static <T> Collection<T>arrayAsCollection(T[] value) static Objectstatic CollectionasCollection(Object value) static <T> Collection<T>asCollection(T[] value) static booleanbooleanUnbox(Object value) static Objectbox(boolean value) Deprecated.static Objectbox(byte value) Deprecated.static Objectbox(char value) Deprecated.static Objectbox(double value) Deprecated.static Objectbox(float value) Deprecated.static Objectbox(int value) Deprecated.static Objectbox(long value) Deprecated.static Objectbox(short value) Deprecated.static bytestatic booleancastToBoolean(Object object) Method used for coercing an object to a boolean value, thanks to anasBoolean()method added on types.static charcastToChar(Object object) Deprecated.static NumbercastToNumber(Object object) static NumbercastToNumber(Object object, Class type) static ObjectcastToType(Object object, Class type) static ObjectcastToVargsArray(Object[] origin, int firstVargsPos, Class<?> arrayType) static charstatic booleancompareArrayEqual(Object left, Object right) static booleancompareEqual(Object left, Object right) static intCompares the two objects handling nulls gracefully and performing numeric type coercion if requiredstatic boolean[]Deprecated.static byte[]Deprecated.static char[]Deprecated.static double[]Deprecated.static float[]Deprecated.static int[]Deprecated.static long[]Deprecated.static ObjectconvertToPrimitiveArray(Object a, Class type) Deprecated.static short[]Deprecated.static doubledoubleUnbox(Object value) static floatfloatUnbox(Object value) static CharactergetCharFromSizeOneString(Object value) Deprecated.static intstatic booleanisEnumSubclass(Object value) Deprecated.static longstatic Object[]primitiveArrayBox(Object array) static ListprimitiveArrayToList(Object array) Allows conversion of arrays into a mutable Liststatic ListAllows conversion of arrays into an immutable List viewstatic shortshortUnbox(Object value) 
- 
Field Details- 
EMPTY_ARGUMENTS
- 
ONE_NEG
 
- 
- 
Constructor Details- 
DefaultTypeTransformationpublic DefaultTypeTransformation()
 
- 
- 
Method Details- 
byteUnbox
- 
charUnbox
- 
shortUnbox
- 
intUnbox
- 
booleanUnbox
- 
longUnbox
- 
floatUnbox
- 
doubleUnbox
- 
boxDeprecated.
- 
boxDeprecated.
- 
boxDeprecated.
- 
boxDeprecated.
- 
boxDeprecated.
- 
boxDeprecated.
- 
boxDeprecated.
- 
boxDeprecated.
- 
castToNumber
- 
castToNumber
- 
castToBooleanMethod used for coercing an object to a boolean value, thanks to anasBoolean()method added on types.- Parameters:
- object- to coerce to a boolean value
- Returns:
- a boolean value
 
- 
castToCharDeprecated.
- 
castToType
- 
asArray
- 
asCollection
- 
asCollection
- 
arrayAsCollection
- 
arrayAsCollection
- 
isEnumSubclassDeprecated.Determines whether the value object is a Class object representing a subclass of java.lang.Enum. Uses class name check to avoid breaking on pre-Java 5 JREs.- Parameters:
- value- an object
- Returns:
- true if the object is an Enum
 
- 
primitiveArrayToListAllows conversion of arrays into a mutable List- Parameters:
- array- an array
- Returns:
- the array as a List
 
- 
primitiveArrayToUnmodifiableListAllows conversion of arrays into an immutable List view- Parameters:
- array- an array
- Returns:
- a List view of the array
 
- 
primitiveArrayBox
- 
compareToCompares the two objects handling nulls gracefully and performing numeric type coercion if required
- 
compareEqual
- 
compareArrayEqual
- 
convertToIntArrayDeprecated.
- 
convertToBooleanArrayDeprecated.
- 
convertToByteArrayDeprecated.
- 
convertToShortArrayDeprecated.
- 
convertToCharArrayDeprecated.
- 
convertToLongArrayDeprecated.
- 
convertToFloatArrayDeprecated.
- 
convertToDoubleArrayDeprecated.
- 
convertToPrimitiveArrayDeprecated.
- 
getCharFromSizeOneStringDeprecated.
- 
castToVargsArray
 
-