Package org.apache.commons.jxpath.util
Class TypeUtils
java.lang.Object
org.apache.commons.jxpath.util.TypeUtils
Global type conversion utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canConvert
(Object object, Class toType) Returns true if the global converter can convert the supplied object to the specified type.static Object
Converts the supplied object to the specified type.static TypeConverter
Returns the current type converter.static void
setTypeConverter
(TypeConverter converter) Install an alternative type converter.static Class
Return the appropriate wrapper type for the specified class.
-
Constructor Details
-
TypeUtils
Deprecated.Will be private in the next major version.Constructs a new instance.
-
-
Method Details
-
canConvert
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
Converts the supplied object to the specified type. May throw a RuntimeException.- Parameters:
object
- object to converttoType
- target class- Returns:
- resulting Object
-
getTypeConverter
Returns the current type converter.- Returns:
- TypeConverter
-
setTypeConverter
Install an alternative type converter.- Parameters:
converter
- new TypeConverter
-
wrapPrimitive
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, elsep
. - Since:
- JXPath 1.3
-