DefaultTypeTransformation (Groovy 5.0.6)

Package: org.codehaus.groovy.runtime.typehandling

## [Java] Class DefaultTypeTransformation

- org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation

-     public class DefaultTypeTransformation
      extends Object

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

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected static Object[]` | `EMPTY_ARGUMENTS` |
    `protected static BigInteger` | `ONE_NEG` |

  - ### Methods Summary

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

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### @Deprecated(forRemoval = true, since = "5.0.0")
      protected static final Object[] EMPTY_ARGUMENTS

    - #### @Deprecated(forRemoval = true, since = "5.0.0")
      protected static final BigInteger ONE_NEG

  - ### Method Detail

    - #### public static Collection arrayAsCollection(Object value)

    - #### <T> public static Collection<T> arrayAsCollection(T[] value)

    - #### public static Object asArray(Object object, Class type)

    - #### <T> public static Collection<T> asCollection(T[] value)

    - #### public static Collection asCollection(Object value)

    - #### public static boolean booleanUnbox(Object value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(boolean value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(byte value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(char value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(short value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(int value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(long value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(float value)

    - #### @Deprecated(since = "2.3.0")
      public static Object box(double value)

    - #### public static byte byteUnbox(Object value)

    - #### 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

    - #### @Deprecated(since = "2.3.0")
      public static char castToChar(Object object)

    - #### public static Number castToNumber(Object object)

    - #### public static Number castToNumber(Object object, Class type)

    - #### public static Object castToType(Object object, Class type)

    - #### public static Object castToVargsArray(Object[] origin, int firstVargsPos, Class<?> arrayType)

    - #### public static char charUnbox(Object value)

    - #### public static boolean compareArrayEqual(Object left, Object right)

    - #### public static boolean compareEqual(Object left, Object right)

    - #### public static int compareTo(Object left, Object right)

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

    - #### @Deprecated(since = "2.3.0")
      public static boolean[] convertToBooleanArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static byte[] convertToByteArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static char[] convertToCharArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static double[] convertToDoubleArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static float[] convertToFloatArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static int[] convertToIntArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static long[] convertToLongArray(Object a)

    - #### @Deprecated(since = "2.3.0")
      public static Object convertToPrimitiveArray(Object a, Class type)

    - #### @Deprecated(since = "2.3.0")
      public static short[] convertToShortArray(Object a)

    - #### public static double doubleUnbox(Object value)

    - #### public static float floatUnbox(Object value)

    - #### @Deprecated(since = "2.3.0")
      public static Character getCharFromSizeOneString(Object value)

    - #### public static int intUnbox(Object value)

    - #### @Deprecated(since = "2.3.0")
      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

    - #### public static long longUnbox(Object value)

    - #### public static Object[] primitiveArrayBox(Object array)

    - #### public static List primitiveArrayToList(Object array)

      Allows conversion of arrays into a mutable List

      Parameters:
        `array` - an array
      Returns:
        the array as a List

    - #### public static List primitiveArrayToUnmodifiableList(Object array)

      Allows conversion of arrays into an immutable List view

      Parameters:
        `array` - an array
      Returns:
        a List view of the array

    - #### public static short shortUnbox(Object value)