org.databene.commons.converter
Class ConstructorInvoker<S,T>

java.lang.Object
  extended by org.databene.commons.converter.AbstractConverter<S,T>
      extended by org.databene.commons.converter.ThreadSafeConverter<S,T>
          extended by org.databene.commons.converter.ConstructorInvoker<S,T>
All Implemented Interfaces:
java.lang.Cloneable, Converter<S,T>, ThreadAware
Direct Known Subclasses:
String2BooleanConverter, String2NumberConverter

public class ConstructorInvoker<S,T>
extends ThreadSafeConverter<S,T>

Converter implementation which invokes a constructor of the target class with the source object as argument.

Created: 27.02.2010 06:57:40

Since:
0.5.0
Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.commons.converter.AbstractConverter
sourceType, targetType
 
Constructor Summary
ConstructorInvoker(java.lang.Class<S> sourceType, java.lang.reflect.Constructor<T> constructor)
           
 
Method Summary
 T convert(S sourceValue)
          Concerts an object of type S to an object of type T
 
Methods inherited from class org.databene.commons.converter.ThreadSafeConverter
clone, isParallelizable, isThreadSafe
 
Methods inherited from class org.databene.commons.converter.AbstractConverter
getSourceType, getTargetType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructorInvoker

public ConstructorInvoker(java.lang.Class<S> sourceType,
                          java.lang.reflect.Constructor<T> constructor)
Method Detail

convert

public T convert(S sourceValue)
          throws ConversionException
Description copied from interface: Converter
Concerts an object of type S to an object of type T

Parameters:
sourceValue - the object to convert
Returns:
the converted object
Throws:
ConversionException - if the conversion fails


Copyright © 2010. All Rights Reserved.