Package org.codehaus.groovy.vmplugin.v8

# Class TypeHelper

java.lang.Object
org.codehaus.groovy.vmplugin.v8.TypeHelper

public class TypeHelper extends Object
This class contains helper methods for converting and comparing types. WARNING: This class is for internal use only. Do not use it outside of its package and not outside of groovy-core.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TypeHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected static boolean`
  `argumentClassIsParameterClass(Class<?> argumentClass, Class<?> parameterClass)`
  Realizes an unsharp equal for the class.
  `protected static Class<?>`
  `getUnboxedType(Class<?> c)`
  Returns the primitive type for a wrapper class when one exists.
  `protected static Class<?>`
  `getWrapperClass(Class<?> c)`
  Gets wrapper class for a given class.
  `protected static boolean`
  `isBigDecCategory(Class<?> x)`
  Checks whether the type belongs to Groovy's BigDecimal category.
  `protected static boolean`
  `isDoubleCategory(Class<?> x)`
  Checks whether the type belongs to Groovy's floating-point category.
  `protected static boolean`
  `isIntCategory(Class<?> x)`
  Checks whether the type belongs to Groovy's integral-int category.
  `protected static boolean`
  `isLongCategory(Class<?> x)`
  Checks whether the type belongs to Groovy's integral-long category.
  `protected static MethodType`
  `replaceWithMoreSpecificType(Object[] args, MethodType callSiteType)`
  Replaces the types in the callSiteType parameter if more specific types given through the arguments.

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

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

- ## Constructor Details

  - ### TypeHelper

    public TypeHelper()

- ## Method Details

  - ### getUnboxedType

    protected static Class<?> getUnboxedType(Class<?> c)
    Returns the primitive type for a wrapper class when one exists.
    Parameters:
      `c` - the type to unbox
    Returns:
      the primitive counterpart, or the original type

  - ### getWrapperClass

    protected static Class<?> getWrapperClass(Class<?> c)
    Gets wrapper class for a given class. If the class is for a primitive number type, then the wrapper class will be returned. If it is not a primitive number type, we return the class itself.

  - ### argumentClassIsParameterClass

    protected static boolean argumentClassIsParameterClass(Class<?> argumentClass, Class<?> parameterClass)
    Realizes an unsharp equal for the class. In general we return true if the provided arguments are the same. But we will also return true if our argument class is a wrapper for the parameter class. For example the parameter is an int and the argument class is a wrapper.

  - ### replaceWithMoreSpecificType

    protected static MethodType replaceWithMoreSpecificType(Object[] args, MethodType callSiteType)
    Replaces the types in the callSiteType parameter if more specific types given through the arguments. This is in general the case, unless the argument is null.

  - ### isIntCategory

    protected static boolean isIntCategory(Class<?> x)
    Checks whether the type belongs to Groovy's integral-int category.
    Parameters:
      `x` - the type to test
    Returns:
      `true` if the type is treated as an int-like type

  - ### isLongCategory

    protected static boolean isLongCategory(Class<?> x)
    Checks whether the type belongs to Groovy's integral-long category.
    Parameters:
      `x` - the type to test
    Returns:
      `true` if the type is treated as a long-like type

  - ### isBigDecCategory

    protected static boolean isBigDecCategory(Class<?> x)
    Checks whether the type belongs to Groovy's BigDecimal category.
    Parameters:
      `x` - the type to test
    Returns:
      `true` if the type is treated as a BigDecimal-like type

  - ### isDoubleCategory

    protected static boolean isDoubleCategory(Class<?> x)
    Checks whether the type belongs to Groovy's floating-point category.
    Parameters:
      `x` - the type to test
    Returns:
      `true` if the type is treated as a double-like type