|
Joda System API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.joda.typeconvertor.TypeConvertorManager
TypeConvertorManager controls all the object to object type convertors. To use,
Constructor Summary | |
TypeConvertorManager()
|
Method Summary | |
abstract void |
addTypeConvertor(TypeConvertor convertor)
Add a type convertor used to convert an object from one type to another. |
abstract void |
addTypeConvertorFactory(TypeConvertor.ConvertorFactory typeConvertorFactory)
Add a type convertor factory used to create type convertors. |
abstract java.lang.Object |
convertFromObject(java.lang.Class convertTo,
java.lang.Object object,
java.lang.Object errSource)
Convert an object from one type to another. |
abstract java.lang.String |
convertToString(java.lang.Class convertFrom,
java.lang.Object object,
java.lang.Object errSource)
Convert an object to a formal string. |
static TypeConvertorManager |
getInstance()
Gets the TypeConvertorManager singleton instance. |
abstract TypeConvertor |
getTypeConvertor(java.lang.Class type)
Get a type convertor used to convert an object from one type to another |
static void |
setInstance(TypeConvertorManager manager)
Sets the TypeConvertorManager singleton instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TypeConvertorManager()
Method Detail |
public static TypeConvertorManager getInstance()
public static void setInstance(TypeConvertorManager manager)
manager
- the TypeConvertorManager to set as the defaultpublic abstract TypeConvertor getTypeConvertor(java.lang.Class type)
type
- the type to convert to
public abstract java.lang.Object convertFromObject(java.lang.Class convertTo, java.lang.Object object, java.lang.Object errSource)
All type convertors should accept String and null as inputs.
The String should be formatted as per the output of the matching
convertToString
.
object
- the object to converterrSource
- the object to indicate errors belong to
public abstract java.lang.String convertToString(java.lang.Class convertFrom, java.lang.Object object, java.lang.Object errSource)
convertFrom
- the type to convert fromobject
- the object to converterrSource
- the object to indicate errors belong to
public abstract void addTypeConvertor(TypeConvertor convertor)
convertor
- the convertorpublic abstract void addTypeConvertorFactory(TypeConvertor.ConvertorFactory typeConvertorFactory)
This method allows for type convertors which can handle a number of related classes. One example is the enumeration pattern, where an application may have many enumeration classes each needing similar but slightly different conversion.
The type convertor will be created on demand by calling the create method on the factory.
typeConvertorFactory
- the convertor factory
|
Joda System API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |