Class BasicTypeConverter
java.lang.Object
org.apache.commons.jxpath.util.BasicTypeConverter
- All Implemented Interfaces:
TypeConverter
- Direct Known Subclasses:
JXPath11CompatibleTypeConverter
The default implementation of TypeConverter.
- Version:
- $Revision: 670727 $ $Date: 2008-06-23 15:10:38 -0500 (Mon, 23 Jun 2008) $
- Author:
- Dmitri Plotnikov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classNodeSet implementation(package private) static final classValue pointer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CollectionallocateCollection(Class type) Create a collection of a given type.protected NumberallocateNumber(Class type, double value) Allocate a number of a given type and value.booleancanConvert(Object object, Class toType) Returns true if it can convert the supplied object to the specified class.protected booleancanCreateCollection(Class type) Learn whether this BasicTypeConverter can create a collection of the specified type.Converts the supplied object to the specified type.protected ObjectconvertNullToPrimitive(Class toType) Convert null to a primitive type.protected ObjectconvertStringToPrimitive(Object object, Class toType) Convert a string to a primitive type.protected CollectionunmodifiableCollection(Collection collection) Get an unmodifiable version of a collection.
-
Constructor Details
-
BasicTypeConverter
public BasicTypeConverter()
-
-
Method Details
-
canConvert
Returns true if it can convert the supplied object to the specified class.- Specified by:
canConvertin interfaceTypeConverter- Parameters:
object- to checktoType- prospective destination class- Returns:
- boolean
-
convert
Converts the supplied object to the specified type. Throws a runtime exception if the conversion is not possible.- Specified by:
convertin interfaceTypeConverter- Parameters:
object- to converttoType- destination class- Returns:
- converted object
-
convertNullToPrimitive
-
convertStringToPrimitive
-
allocateNumber
-
canCreateCollection
Learn whether this BasicTypeConverter can create a collection of the specified type.- Parameters:
type- prospective destination class- Returns:
- boolean
-
allocateCollection
Create a collection of a given type.- Parameters:
type- destination class- Returns:
- Collection
-
unmodifiableCollection
Get an unmodifiable version of a collection.- Parameters:
collection- to wrap- Returns:
- Collection
-