org.apache.commons.jxpath.util
Class BasicTypeConverter

java.lang.Object
  extended byorg.apache.commons.jxpath.util.BasicTypeConverter
All 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

Nested Class Summary
(package private) static class BasicTypeConverter.ValueNodeSet
           
(package private) static class BasicTypeConverter.ValuePointer
           
 
Constructor Summary
BasicTypeConverter()
           
 
Method Summary
protected  java.util.Collection allocateCollection(java.lang.Class type)
           
protected  java.lang.Number allocateNumber(java.lang.Class type, double value)
           
 boolean canConvert(java.lang.Object object, java.lang.Class toType)
          Returns true if it can convert the supplied object to the specified class.
protected  boolean canCreateCollection(java.lang.Class type)
           
 java.lang.Object convert(java.lang.Object object, java.lang.Class toType)
          Converts the supplied object to the specified type.
protected  java.lang.Object convertNullToPrimitive(java.lang.Class toType)
           
protected  java.lang.Object convertStringToPrimitive(java.lang.Object object, java.lang.Class toType)
           
protected  java.util.Collection unmodifiableCollection(java.util.Collection collection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicTypeConverter

public BasicTypeConverter()
Method Detail

canConvert

public boolean canConvert(java.lang.Object object,
                          java.lang.Class toType)
Returns true if it can convert the supplied object to the specified class.

Specified by:
canConvert in interface TypeConverter

convert

public java.lang.Object convert(java.lang.Object object,
                                java.lang.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 java.lang.Object convertNullToPrimitive(java.lang.Class toType)

convertStringToPrimitive

protected java.lang.Object convertStringToPrimitive(java.lang.Object object,
                                                    java.lang.Class toType)

allocateNumber

protected java.lang.Number allocateNumber(java.lang.Class type,
                                          double value)

canCreateCollection

protected boolean canCreateCollection(java.lang.Class type)

allocateCollection

protected java.util.Collection allocateCollection(java.lang.Class type)

unmodifiableCollection

protected java.util.Collection unmodifiableCollection(java.util.Collection collection)