public class BasicTypeConverter extends Object implements TypeConverter
Constructor and Description |
---|
BasicTypeConverter() |
Modifier and Type | Method and Description |
---|---|
protected Collection |
allocateCollection(Class type)
Create a collection of a given type.
|
protected Number |
allocateNumber(Class type,
double value)
Allocate a number of a given type and value.
|
boolean |
canConvert(Object object,
Class toType)
Returns true if it can convert the supplied
object to the specified class.
|
protected boolean |
canCreateCollection(Class type)
Learn whether this BasicTypeConverter can create a collection of the specified type.
|
Object |
convert(Object object,
Class toType)
Converts the supplied object to the specified
type.
|
protected Object |
convertNullToPrimitive(Class toType)
Convert null to a primitive type.
|
protected Object |
convertStringToPrimitive(Object object,
Class toType)
Convert a string to a primitive type.
|
protected Collection |
unmodifiableCollection(Collection collection)
Get an unmodifiable version of a collection.
|
public BasicTypeConverter()
public boolean canConvert(Object object, Class toType)
canConvert
in interface TypeConverter
object
- to checktoType
- prospective destination classpublic Object convert(Object object, Class toType)
convert
in interface TypeConverter
object
- to converttoType
- destination classprotected Object convertNullToPrimitive(Class toType)
toType
- destination classprotected Object convertStringToPrimitive(Object object, Class toType)
object
- StringtoType
- destination classprotected Number allocateNumber(Class type, double value)
type
- destination classvalue
- doubleprotected boolean canCreateCollection(Class type)
type
- prospective destination classprotected Collection allocateCollection(Class type)
type
- destination classprotected Collection unmodifiableCollection(Collection collection)
collection
- to wrapCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.