jodd.typeconverter
Class TypeConverterManager

java.lang.Object
  extended by jodd.typeconverter.TypeConverterManager

public class TypeConverterManager
extends java.lang.Object

Provides dynamic object conversion to a type. Contains a map of registered converters. User may add new converter. Static version of TypeConverterManagerBean.


Constructor Summary
TypeConverterManager()
           
 
Method Summary
static
<T> T
convertType(java.lang.Object value, java.lang.Class<T> destinationType)
          Casts an object to destination type using type conversion.
static TypeConverterManagerBean getDefaultTypeConverterManager()
          Returns default TypeConverterManager.
static TypeConverter lookup(java.lang.Class type)
          Retrieves converter for provided type.
static void register(java.lang.Class type, TypeConverter typeConverter)
          Registers a converter for specified type.
static void registerDefaults()
          Registers default set of converters.
static void unregister(java.lang.Class type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeConverterManager

public TypeConverterManager()
Method Detail

getDefaultTypeConverterManager

public static TypeConverterManagerBean getDefaultTypeConverterManager()
Returns default TypeConverterManager.


registerDefaults

public static void registerDefaults()
Registers default set of converters.


register

public static void register(java.lang.Class type,
                            TypeConverter typeConverter)
Registers a converter for specified type. User must register converter for all super-classes as well.

Parameters:
type - class that converter is for
typeConverter - converter for provided class

unregister

public static void unregister(java.lang.Class type)

lookup

public static TypeConverter lookup(java.lang.Class type)
Retrieves converter for provided type. Only registered types are matched, therefore subclasses must be also registered.

Returns:
founded converter or null

convertType

public static <T> T convertType(java.lang.Object value,
                                java.lang.Class<T> destinationType)
Casts an object to destination type using type conversion. If destination type is one of common types, consider using Convert instead.



Copyright © 2003-2012 Jodd Team