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.- Version:
- $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
- Author:
- Dmitri Plotnikov
-
-
Constructor Summary
Constructors Constructor Description TypeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods 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.
-
-
-
Method Detail
-
setTypeConverter
public static void setTypeConverter(TypeConverter converter)
Install an alternative type converter.- Parameters:
converter
- new TypeConverter
-
getTypeConverter
public static TypeConverter getTypeConverter()
Returns the current type converter.- Returns:
- TypeConverter
-
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 testtoType
- 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 converttoType
- target class- Returns:
- resulting Object
-
-