public interface TypeConverterFactory extends ConfigurableComponent
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.Class<?> targetType,
java.lang.Class<? extends TypeConverter<?>> converterClass)
Adds a type converter to the set of registered type converters, overriding an existing
converter if one was already registered for the type.
|
TypeConverter |
getInstance(java.lang.Class<? extends TypeConverter> clazz,
java.util.Locale locale)
Gets an instance of the TypeConverter class specified.
|
TypeConverter |
getTypeConverter(java.lang.Class forType,
java.util.Locale locale)
Gets the applicable type converter for the class passed in.
|
initTypeConverter getTypeConverter(java.lang.Class forType, java.util.Locale locale) throws java.lang.Exception
forType - the type/Class that is the target type of the conversion. It is assumed that
the input type is String, so to convert a String to a Date object you would supply
java.util.Date.class.locale - the locale of the Strings to be converted with the returned converterjava.lang.Exception - if the TypeConverter cannot be instantiatedTypeConverter getInstance(java.lang.Class<? extends TypeConverter> clazz, java.util.Locale locale) throws java.lang.Exception
clazz - the Class object representing the desired TypeConverterlocale - the locale of the Strings to be converted with the returned converterjava.lang.Exception - if the TypeConverter cannot be instantiatedvoid add(java.lang.Class<?> targetType,
java.lang.Class<? extends TypeConverter<?>> converterClass)
UnsupportedOperationException.targetType - the type for which the converter will handle conversionsconverterClass - the implementation class that will handle the conversionsjava.lang.UnsupportedOperationException - if the implementation does not support adding type
converters at runtime? Copyright 2005-2006, Stripes Development Team.