Class DefaultTypeTransformation
java.lang.Object
org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation
Class providing various type conversions, coercions and boxing/unboxing operations.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final Object[]
protected static final BigInteger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection
arrayAsCollection
(Object value) static <T> Collection<T>
arrayAsCollection
(T[] value) static Object
static Collection
asCollection
(Object value) static <T> Collection<T>
asCollection
(T[] value) static boolean
booleanUnbox
(Object value) static Object
box
(boolean value) Deprecated.static Object
box
(byte value) Deprecated.static Object
box
(char value) Deprecated.static Object
box
(double value) Deprecated.static Object
box
(float value) Deprecated.static Object
box
(int value) Deprecated.static Object
box
(long value) Deprecated.static Object
box
(short value) Deprecated.static byte
static boolean
castToBoolean
(Object object) Method used for coercing an object to a boolean value, thanks to anasBoolean()
method added on types.static char
castToChar
(Object object) Deprecated.static Number
castToNumber
(Object object) static Number
castToNumber
(Object object, Class type) static Object
castToType
(Object object, Class type) static Object
castToVargsArray
(Object[] origin, int firstVargsPos, Class<?> arrayType) static char
static boolean
compareArrayEqual
(Object left, Object right) static boolean
compareEqual
(Object left, Object right) static int
Compares 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 Object
convertToPrimitiveArray
(Object a, Class type) Deprecated.static short[]
Deprecated.static double
doubleUnbox
(Object value) static float
floatUnbox
(Object value) static Character
getCharFromSizeOneString
(Object value) Deprecated.static int
static boolean
isEnumSubclass
(Object value) Deprecated.static long
static Object[]
primitiveArrayBox
(Object array) static List
primitiveArrayToList
(Object array) Allows conversion of arrays into a mutable Liststatic List
Allows conversion of arrays into an immutable List viewstatic short
shortUnbox
(Object value)
-
Field Details
-
EMPTY_ARGUMENTS
-
ONE_NEG
-
-
Constructor Details
-
DefaultTypeTransformation
public DefaultTypeTransformation()
-
-
Method Details
-
byteUnbox
-
charUnbox
-
shortUnbox
-
intUnbox
-
booleanUnbox
-
longUnbox
-
floatUnbox
-
doubleUnbox
-
box
Deprecated. -
box
Deprecated. -
box
Deprecated. -
box
Deprecated. -
box
Deprecated. -
box
Deprecated. -
box
Deprecated. -
box
Deprecated. -
castToNumber
-
castToNumber
-
castToBoolean
Method 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
-
castToChar
Deprecated. -
castToType
-
asArray
-
asCollection
-
asCollection
-
arrayAsCollection
-
arrayAsCollection
-
isEnumSubclass
Deprecated.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
-
primitiveArrayToList
Allows conversion of arrays into a mutable List- Parameters:
array
- an array- Returns:
- the array as a List
-
primitiveArrayToUnmodifiableList
Allows conversion of arrays into an immutable List view- Parameters:
array
- an array- Returns:
- a List view of the array
-
primitiveArrayBox
-
compareTo
Compares the two objects handling nulls gracefully and performing numeric type coercion if required -
compareEqual
-
compareArrayEqual
-
convertToIntArray
Deprecated. -
convertToBooleanArray
Deprecated. -
convertToByteArray
Deprecated. -
convertToShortArray
Deprecated. -
convertToCharArray
Deprecated. -
convertToLongArray
Deprecated. -
convertToFloatArray
Deprecated. -
convertToDoubleArray
Deprecated. -
convertToPrimitiveArray
Deprecated. -
getCharFromSizeOneString
Deprecated. -
castToVargsArray
-