Groovy 1.7.10

## org.codehaus.groovy.runtime.typehandling
[Java] Class DefaultTypeTransformation

    java.lang.Object
      org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation

    public class DefaultTypeTransformation
    extends Object

Class providing various type conversions, coercions and boxing/unboxing operations.

Authors:
  Guillaume Laforge

Field Summary
`protected static Object[]` | `EMPTY_ARGUMENTS`
`protected static BigInteger` | `ONE_NEG`

Method Summary
`static Collection` | `arrayAsCollection(Object value)`
`static Collection` | `arrayAsCollection(T[] value)`
`static Object` | `asArray(Object object, Class type)`
`static Collection` | `asCollection(T[] value)`
`static Collection` | `asCollection(Object value)`
`static boolean` | `booleanUnbox(Object value)`
`static Object` | `box(boolean value)`
`static Object` | `box(byte value)`
`static Object` | `box(char value)`
`static Object` | `box(short value)`
`static Object` | `box(int value)`
`static Object` | `box(long value)`
`static Object` | `box(float value)`
`static Object` | `box(double value)`
`static byte` | `byteUnbox(Object value)`
`static boolean` | `castToBoolean(Object object)` Method used for coercing an object to a boolean value, thanks to an `asBoolean()` method added on types.
`static char` | `castToChar(Object object)`
`static Number` | `castToNumber(Object object)`
`static Number` | `castToNumber(Object object, Class type)`
`static Object` | `castToType(Object object, Class type)`
`static char` | `charUnbox(Object value)`
`static boolean` | `compareArrayEqual(Object left, Object right)`
`static boolean` | `compareEqual(Object left, Object right)`
`static int` | `compareTo(Object left, Object right)` Compares the two objects handling nulls gracefully and performing numeric type coercion if required
`static boolean[]` | `convertToBooleanArray(Object a)`
`static byte[]` | `convertToByteArray(Object a)`
`static char[]` | `convertToCharArray(Object a)`
`static double[]` | `convertToDoubleArray(Object a)`
`static float[]` | `convertToFloatArray(Object a)`
`static int[]` | `convertToIntArray(Object a)`
`static long[]` | `convertToLongArray(Object a)`
`static Object` | `convertToPrimitiveArray(Object a, Class type)`
`static short[]` | `convertToShortArray(Object a)`
`static double` | `doubleUnbox(Object value)`
`static float` | `floatUnbox(Object value)`
`static Character` | `getCharFromSizeOneString(Object value)`
`static int` | `intUnbox(Object value)`
`static boolean` | `isEnumSubclass(Object value)` Determines whether the value object is a Class object representing a subclass of java.lang.Enum.
`static long` | `longUnbox(Object value)`
`static Object[]` | `primitiveArrayBox(Object array)`
`static List` | `primitiveArrayToList(Object array)` Allows conversion of arrays into a mutable List
`static short` | `shortUnbox(Object value)`

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Field Detail

### EMPTY_ARGUMENTS

    protected static final Object[] EMPTY_ARGUMENTS

### ONE_NEG

    protected static final BigInteger ONE_NEG

Method Detail

### arrayAsCollection

    public static Collection arrayAsCollection(Object value)

### arrayAsCollection

    public static Collection arrayAsCollection(T[] value)

### asArray

    public static Object asArray(Object object, Class type)

### asCollection

    public static Collection asCollection(T[] value)

### asCollection

    public static Collection asCollection(Object value)

### booleanUnbox

    public static boolean booleanUnbox(Object value)

### box

    public static Object box(boolean value)

### box

    public static Object box(byte value)

### box

    public static Object box(char value)

### box

    public static Object box(short value)

### box

    public static Object box(int value)

### box

    public static Object box(long value)

### box

    public static Object box(float value)

### box

    public static Object box(double value)

### byteUnbox

    public static byte byteUnbox(Object value)

### castToBoolean

    public static boolean castToBoolean(Object object)

  Method used for coercing an object to a boolean value, thanks to an `asBoolean()` method added on types.
  Parameters:
    `object` - to coerce to a boolean value
  Returns:
    a boolean value

### castToChar

    public static char castToChar(Object object)

### castToNumber

    public static Number castToNumber(Object object)

### castToNumber

    public static Number castToNumber(Object object, Class type)

### castToType

    public static Object castToType(Object object, Class type)

### charUnbox

    public static char charUnbox(Object value)

### compareArrayEqual

    public static boolean compareArrayEqual(Object left, Object right)

### compareEqual

    public static boolean compareEqual(Object left, Object right)

### compareTo

    public static int compareTo(Object left, Object right)

  Compares the two objects handling nulls gracefully and performing numeric type coercion if required

### convertToBooleanArray

    public static boolean[] convertToBooleanArray(Object a)

### convertToByteArray

    public static byte[] convertToByteArray(Object a)

### convertToCharArray

    public static char[] convertToCharArray(Object a)

### convertToDoubleArray

    public static double[] convertToDoubleArray(Object a)

### convertToFloatArray

    public static float[] convertToFloatArray(Object a)

### convertToIntArray

    public static int[] convertToIntArray(Object a)

### convertToLongArray

    public static long[] convertToLongArray(Object a)

### convertToPrimitiveArray

    public static Object convertToPrimitiveArray(Object a, Class type)

### convertToShortArray

    public static short[] convertToShortArray(Object a)

### doubleUnbox

    public static double doubleUnbox(Object value)

### floatUnbox

    public static float floatUnbox(Object value)

### getCharFromSizeOneString

    public static Character getCharFromSizeOneString(Object value)

### intUnbox

    public static int intUnbox(Object value)

### isEnumSubclass

    public static boolean isEnumSubclass(Object value)

  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

### longUnbox

    public static long longUnbox(Object value)

### primitiveArrayBox

    public static Object[] primitiveArrayBox(Object array)

### primitiveArrayToList

    public static List primitiveArrayToList(Object array)

  Allows conversion of arrays into a mutable List
  Parameters:
    `array` - an array
  Returns:
    the array as a List

### shortUnbox

    public static short shortUnbox(Object value)

Copyright © 2003-2010 The Codehaus. All rights reserved.