public class TypeConverterManager
extends java.lang.Object
| Constructor and Description |
|---|
TypeConverterManager(Converter converter) |
| Modifier and Type | Method and Description |
|---|---|
<C extends java.util.Collection<T>,T> |
convertToCollection(java.lang.Object value,
java.lang.Class<? extends java.util.Collection> destinationType,
java.lang.Class<T> componentType)
Special case of
convertType(Object, Class) when target is collection and
when component type is known. |
<T> T |
convertType(java.lang.Object value,
java.lang.Class<T> destinationType)
Converts an object to destination type.
|
static TypeConverterManager |
get()
Returns default instance.
|
TypeConverter |
lookup(java.lang.Class type)
Retrieves converter for provided type.
|
void |
register(java.lang.Class type,
TypeConverter typeConverter)
Registers a converter for specified type.
|
void |
registerDefaults()
Registers default set of converters.
|
void |
unregister(java.lang.Class type)
Un-registers converter for given type.
|
public TypeConverterManager(Converter converter)
public static TypeConverterManager get()
public void registerDefaults()
public void register(java.lang.Class type,
TypeConverter typeConverter)
type - class that converter is fortypeConverter - converter for provided classpublic void unregister(java.lang.Class type)
public TypeConverter lookup(java.lang.Class type)
nullpublic <T> T convertType(java.lang.Object value,
java.lang.Class<T> destinationType)
TypeConverter will be used. If not, it scans of destination is
an array or enum, as those two cases are handled in a special way.
If destination type is one of common types, consider using Converter
instead for somewhat faster approach (no lookup).
public <C extends java.util.Collection<T>,T> C convertToCollection(java.lang.Object value,
java.lang.Class<? extends java.util.Collection> destinationType,
java.lang.Class<T> componentType)
convertType(Object, Class) when target is collection and
when component type is known.Copyright © 2003-present Jodd Team