Joda System API

org.joda.typeconvertor
Interface TypeConvertor

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractTypeConvertor

public interface TypeConvertor
extends java.io.Serializable

A TypeConvertor converts between one object type and another. TypeConvertorManager should be used to utiliize type convertors.

Author:
Stephen Colebourne

Nested Class Summary
static interface TypeConvertor.ConvertorFactory
          A type convertor factory allows for dynamically created type convertors.
 
Method Summary
 java.lang.Object convertFromObject(java.lang.Object object, java.lang.Object errSource)
          Convert an object from one type to another.
 java.lang.String convertToString(java.lang.Object object, java.lang.Object errSource)
          Convert an object of this convertor's type to a string
 java.lang.Class getType()
          Get the single type that this convertor converts.
 

Method Detail

convertFromObject

public java.lang.Object convertFromObject(java.lang.Object object,
                                          java.lang.Object errSource)
Convert an object from one type to another. The original object may be returned if it is of the correct type and is fully immutable (final and no setters).

Parameters:
object - the object to convert
errSource - the source object used to attach errors to
Returns:
the converted object

convertToString

public java.lang.String convertToString(java.lang.Object object,
                                        java.lang.Object errSource)
Convert an object of this convertor's type to a string

Parameters:
object - the object to convert
errSource - the source object used to attach errors to
Returns:
the converted object

getType

public java.lang.Class getType()
Get the single type that this convertor converts. This may return null if the type is not available on the current JDK version (for example Currency is only available from JDK 1.4).

Returns:
the type of the converted object

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.