Package org.codehaus.groovy.runtime.typehandling

# Class DefaultTypeTransformation

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

    public class DefaultTypeTransformation
    extends java.lang.Object

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

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `protected static java.lang.Object[]` | `EMPTY_ARGUMENTS` |
  `protected static java.math.BigInteger` | `ONE_NEG` |

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `DefaultTypeTransformation()` |

- ## Method Summary

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

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### EMPTY_ARGUMENTS

    protected static final java.lang.Object[] EMPTY_ARGUMENTS

  - ### ONE_NEG

    protected static final java.math.BigInteger ONE_NEG

- ## Constructor Details

  - ### DefaultTypeTransformation

    public DefaultTypeTransformation()

- ## Method Details

  - ### byteUnbox

    public static byte byteUnbox​(java.lang.Object value)

  - ### charUnbox

    public static char charUnbox​(java.lang.Object value)

  - ### shortUnbox

    public static short shortUnbox​(java.lang.Object value)

  - ### intUnbox

    public static int intUnbox​(java.lang.Object value)

  - ### booleanUnbox

    public static boolean booleanUnbox​(java.lang.Object value)

  - ### longUnbox

    public static long longUnbox​(java.lang.Object value)

  - ### floatUnbox

    public static float floatUnbox​(java.lang.Object value)

  - ### doubleUnbox

    public static double doubleUnbox​(java.lang.Object value)

  - ### box

    @Deprecated public static java.lang.Object box​(boolean value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(byte value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(char value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(short value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(int value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(long value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(float value)
    Deprecated.

  - ### box

    @Deprecated public static java.lang.Object box​(double value)
    Deprecated.

  - ### castToNumber

    public static java.lang.Number castToNumber​(java.lang.Object object)

  - ### castToNumber

    public static java.lang.Number castToNumber​(java.lang.Object object, java.lang.Class type)

  - ### castToBoolean

    public static boolean castToBoolean​(java.lang.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

    @Deprecated public static char castToChar​(java.lang.Object object)
    Deprecated.

  - ### castToType

    public static java.lang.Object castToType​(java.lang.Object object, java.lang.Class type)

  - ### asArray

    public static java.lang.Object asArray​(java.lang.Object object, java.lang.Class type)

  - ### asCollection

    public static <T> java.util.Collection<T> asCollection​(T[] value)

  - ### asCollection

    public static java.util.Collection asCollection​(java.lang.Object value)

  - ### arrayAsCollection

    public static java.util.Collection arrayAsCollection​(java.lang.Object value)

  - ### arrayAsCollection

    public static <T> java.util.Collection<T> arrayAsCollection​(T[] value)

  - ### isEnumSubclass

    @Deprecated public static boolean isEnumSubclass​(java.lang.Object value)
    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

    public static java.util.List primitiveArrayToList​(java.lang.Object array)
    Allows conversion of arrays into a mutable List
    Parameters:
      `array` - an array
    Returns:
      the array as a List

  - ### primitiveArrayBox

    public static java.lang.Object[] primitiveArrayBox​(java.lang.Object array)

  - ### compareTo

    public static int compareTo​(java.lang.Object left, java.lang.Object right)
    Compares the two objects handling nulls gracefully and performing numeric type coercion if required

  - ### compareEqual

    public static boolean compareEqual​(java.lang.Object left, java.lang.Object right)

  - ### compareArrayEqual

    public static boolean compareArrayEqual​(java.lang.Object left, java.lang.Object right)

  - ### convertToIntArray

    @Deprecated public static int[] convertToIntArray​(java.lang.Object a)
    Deprecated.

  - ### convertToBooleanArray

    @Deprecated public static boolean[] convertToBooleanArray​(java.lang.Object a)
    Deprecated.

  - ### convertToByteArray

    @Deprecated public static byte[] convertToByteArray​(java.lang.Object a)
    Deprecated.

  - ### convertToShortArray

    @Deprecated public static short[] convertToShortArray​(java.lang.Object a)
    Deprecated.

  - ### convertToCharArray

    @Deprecated public static char[] convertToCharArray​(java.lang.Object a)
    Deprecated.

  - ### convertToLongArray

    @Deprecated public static long[] convertToLongArray​(java.lang.Object a)
    Deprecated.

  - ### convertToFloatArray

    @Deprecated public static float[] convertToFloatArray​(java.lang.Object a)
    Deprecated.

  - ### convertToDoubleArray

    @Deprecated public static double[] convertToDoubleArray​(java.lang.Object a)
    Deprecated.

  - ### convertToPrimitiveArray

    @Deprecated public static java.lang.Object convertToPrimitiveArray​(java.lang.Object a, java.lang.Class type)
    Deprecated.

  - ### getCharFromSizeOneString

    @Deprecated public static java.lang.Character getCharFromSizeOneString​(java.lang.Object value)
    Deprecated.

  - ### castToVargsArray

    public static java.lang.Object castToVargsArray​(java.lang.Object[] origin, int firstVargsPos, java.lang.Class<?> arrayType)