|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.convert.ConverterRegistry
The ConverterRegistry is the central place where all converters are registered.
Field Summary | |
private java.util.Map |
converterCache
This is a cache for reusable custom Converter instances |
private java.util.Map |
converters
This map maps java data types to converters Map |
private java.util.Map |
customConverters
This is a Registry for custom Converter classes |
private Converter |
defaultConverter
The default converter that should be used when no matching converter is available |
private static ConverterRegistry |
instance
Singleton instance |
private org.apache.commons.logging.Log |
log
Logging instance |
Constructor Summary | |
private |
ConverterRegistry()
Constructor |
Method Summary | |
void |
deregister(java.lang.Class dataType)
Remove any registered Converter for the specified destination
Class . |
Converter |
getCustomConverter(java.lang.String converterId)
Look up and custom converter. |
void |
init()
Register the predefined Converters |
static ConverterRegistry |
instance()
Returns the singleton instance of this class |
Converter |
lookup(java.lang.Class dataType)
Look up and return any registered Converter for the specified
destination class; if there is no registered Converter, return a default
String Converter. |
void |
registerCustomConverter(java.lang.String converterId,
java.lang.Class converterClass)
Register a custom Converter for the specified destination
Class , replacing any previously registered Converter. |
void |
registerTypeConverter(java.lang.Class dataType,
Converter converter)
Register a custom Converter for the specified destination
Class , replacing any previously registered Converter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
private java.util.Map converters
private java.util.Map customConverters
private java.util.Map converterCache
private Converter defaultConverter
private static ConverterRegistry instance
Constructor Detail |
private ConverterRegistry()
Method Detail |
public void init()
public static ConverterRegistry instance()
public void registerTypeConverter(java.lang.Class dataType, Converter converter)
Converter
for the specified destination
Class
, replacing any previously registered Converter.
dataType
- Destination class for conversions performed by this Converterconverter
- Converter to be registeredpublic void registerCustomConverter(java.lang.String converterId, java.lang.Class converterClass)
Converter
for the specified destination
Class
, replacing any previously registered Converter.
converterId
- The converters identifier or class nameconverterClass
- Converter class to be registeredpublic void deregister(java.lang.Class dataType)
Converter
for the specified destination
Class
.
dataType
- Class for which to remove a registered Converterpublic Converter lookup(java.lang.Class dataType)
Converter
for the specified
destination class; if there is no registered Converter, return a default
String Converter.
dataType
- Class for which to return a registered Converter
public Converter getCustomConverter(java.lang.String converterId) throws ConverterException
converterId
- The converters identifier or Class name
ConverterException
- is thrown when a conversion error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |