org.castor.cpa.persistence.convertor
Class TypeConvertorRegistry

java.lang.Object
  extended by org.castor.cpa.persistence.convertor.TypeConvertorRegistry

public final class TypeConvertorRegistry
extends Object

Registry of type convertors.

Since:
1.1.3
Version:
$Revision: 8994 $ $Date: 2011-08-02 01:40:59 +0200 (Di, 02 Aug 2011) $
Author:
Ralf Joachim

Constructor Summary
TypeConvertorRegistry(AbstractProperties properties)
          Create a new registry instance of type convertors.
 
Method Summary
 TypeConvertor getConvertor(Class<?> fromType, Class<?> toType, String parameter)
          Returns a type convertor initialized with parameter if specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeConvertorRegistry

public TypeConvertorRegistry(AbstractProperties properties)
Create a new registry instance of type convertors. The registry will be initialized with all type convertors specified through TYPE_CONVERTORS property of given properties. The properties get also passed to the type converters for them to get any required property.

Parameters:
properties - The properties to use.
Method Detail

getConvertor

public TypeConvertor getConvertor(Class<?> fromType,
                                  Class<?> toType,
                                  String parameter)
                           throws MappingException
Returns a type convertor initialized with parameter if specified. A type convertor can be used to convert an object from Java type fromType to Java type toType.

Parameters:
fromType - The Java type to convert from.
toType - The Java type to convert to.
parameter - The parameter for the convertor (null if is not specified).
Returns:
The TypeConverter to convert fromType into toType.
Throws:
MappingException - No suitable convertor was found.


Copyright © 2012. All Rights Reserved.