Package org.apache.commons.jxpath.util

# Class TypeUtils

java.lang.Object
org.apache.commons.jxpath.util.TypeUtils

public class TypeUtils extends Object
Global type conversion utilities.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TypeUtils()`
  Deprecated.
  Will be private in the next major version.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `canConvert(Object object, Class toType)`
  Returns true if the global converter can convert the supplied object to the specified type.
  `static Object`
  `convert(Object object, Class toType)`
  Converts the supplied object to the specified type.
  `static TypeConverter`
  `getTypeConverter()`
  Returns the current type converter.
  `static void`
  `setTypeConverter(TypeConverter converter)`
  Install an alternative type converter.
  `static Class`
  `wrapPrimitive(Class p)`
  Return the appropriate wrapper type for the specified class.

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

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

- ## Constructor Details

  - ### TypeUtils

    @Deprecated public TypeUtils()
    Deprecated.
    Will be private in the next major version.
    Constructs a new instance.

- ## Method Details

  - ### canConvert

    public static boolean canConvert(Object object, Class toType)
    Returns true if the global converter can convert the supplied object to the specified type.
    Parameters:
      `object` - object to test
      `toType` - target class
    Returns:
      boolean

  - ### convert

    public static Object convert(Object object, Class toType)
    Converts the supplied object to the specified type. May throw a RuntimeException.
    Parameters:
      `object` - object to convert
      `toType` - target class
    Returns:
      resulting Object

  - ### getTypeConverter

    public static TypeConverter getTypeConverter()
    Returns the current type converter.
    Returns:
      TypeConverter

  - ### setTypeConverter

    public static void setTypeConverter(TypeConverter converter)
    Install an alternative type converter.
    Parameters:
      `converter` - new TypeConverter

  - ### wrapPrimitive

    public static Class wrapPrimitive(Class p)
    Return the appropriate wrapper type for the specified class.
    Parameters:
      `p` - Class for which to retrieve a wrapper class.
    Returns:
      the wrapper if `p` is primitive, else `p`.
    Since:
      JXPath 1.3