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

java.lang.Object
  extended by org.databene.commons.converter.ConverterWrapper<S,T>
      extended by org.databene.commons.converter.ConverterProxy<S,T>
          extended by org.databene.commons.converter.NullSafeConverterProxy<S,T>
All Implemented Interfaces:
java.lang.Cloneable, Converter<S,T>, ThreadAware

public class NullSafeConverterProxy<S,T>
extends ConverterProxy<S,T>

Wraps another Converter and adds the feature of converting null values to a predefined value.

Created: 26.07.2007 06:59:35

Author:
Volker Bergmann

Field Summary
protected  T nullResult
           
protected  Converter<S,T> realConverter
           
 
Constructor Summary
NullSafeConverterProxy(Converter<S,T> realConverter, T nullResult)
           
 
Method Summary
 T convert(S sourceValue)
          Concerts an object of type S to an object of type T
 java.lang.Class<T> getTargetType()
           
 
Methods inherited from class org.databene.commons.converter.ConverterProxy
getSourceType
 
Methods inherited from class org.databene.commons.converter.ConverterWrapper
clone, isParallelizable, isThreadSafe
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.databene.commons.ThreadAware
isParallelizable, isThreadSafe
 

Field Detail

realConverter

protected Converter<S,T> realConverter

nullResult

protected T nullResult
Constructor Detail

NullSafeConverterProxy

public NullSafeConverterProxy(Converter<S,T> realConverter,
                              T nullResult)
Method Detail

getTargetType

public java.lang.Class<T> getTargetType()
Specified by:
getTargetType in interface Converter<S,T>
Overrides:
getTargetType in class ConverterProxy<S,T>

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.