org.apache.commons.jxpath.util

Class BasicTypeConverter

Implemented Interfaces:
TypeConverter

public class BasicTypeConverter
extends java.lang.Object
implements TypeConverter

The default implementation of TypeConverter.
Version:
$Revision: 1.14 $ $Date: 2004/06/29 21:50:02 $
Author:
Dmitri Plotnikov

Method Summary

protected Collection
allocateCollection(Class type)
protected Number
allocateNumber(Class type, double 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)
Object
convert(Object object, Class toType)
Converts the supplied object to the specified type.
protected Object
convertNullToPrimitive(Class toType)
protected Object
convertStringToPrimitive(Object object, Class toType)
protected Collection
unmodifiableCollection(Collection collection)

Method Details

allocateCollection

protected Collection allocateCollection(Class type)

allocateNumber

protected Number allocateNumber(Class type,
                                double value)

canConvert

public boolean canConvert(Object object,
                          Class toType)
Returns true if it can convert the supplied object to the specified class.
Specified by:
canConvert in interface TypeConverter

canCreateCollection

protected boolean canCreateCollection(Class type)

convert

public Object convert(Object object,
                      Class toType)
Converts the supplied object to the specified type. Throws a runtime exception if the conversion is not possible.
Specified by:
convert in interface TypeConverter

convertNullToPrimitive

protected Object convertNullToPrimitive(Class toType)

convertStringToPrimitive

protected Object convertStringToPrimitive(Object object,
                                          Class toType)

unmodifiableCollection

protected Collection unmodifiableCollection(Collection collection)