net.sf.beanlib.spi
Class ChainedCustomBeanTransformer

java.lang.Object
  extended by net.sf.beanlib.spi.ChainedCustomBeanTransformer
All Implemented Interfaces:
CustomBeanTransformerSpi, Transformable

public class ChainedCustomBeanTransformer
extends Object
implements CustomBeanTransformerSpi

Supports a chain of custom transformation.

Author:
Hanson Char

Nested Class Summary
static class ChainedCustomBeanTransformer.Factory
          Factory to create a ChainedCustomBeanTransformer.
 
Field Summary
private  List<CustomBeanTransformerSpi> customTransformers
           
 
Constructor Summary
private ChainedCustomBeanTransformer()
           
 
Method Summary
private  ChainedCustomBeanTransformer appendCustomerBeanTransformer(CustomBeanTransformerSpi c)
           
 boolean isTransformable(Object from, Class<?> toClass, PropertyInfo propertyInfo)
          Returns true if the given object is to be transformed by this transformer; false otherwise.
<T> T
transform(Object in, Class<T> toClass, PropertyInfo propertyInfo)
          Returns an object transformed from the input object with the given target class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customTransformers

private final List<CustomBeanTransformerSpi> customTransformers
Constructor Detail

ChainedCustomBeanTransformer

private ChainedCustomBeanTransformer()
Method Detail

appendCustomerBeanTransformer

private ChainedCustomBeanTransformer appendCustomerBeanTransformer(CustomBeanTransformerSpi c)

isTransformable

public boolean isTransformable(Object from,
                               Class<?> toClass,
                               PropertyInfo propertyInfo)
Description copied from interface: CustomBeanTransformerSpi
Returns true if the given object is to be transformed by this transformer; false otherwise.

Specified by:
isTransformable in interface CustomBeanTransformerSpi
Parameters:
from - source object
toClass - target class
propertyInfo - If null, it means the in object is a root level object. Otherwise, propertyInfo contains information about the input object as a java bean property value to be transformed.

transform

public <T> T transform(Object in,
                       Class<T> toClass,
                       PropertyInfo propertyInfo)
Description copied from interface: Transformable
Returns an object transformed from the input object with the given target class.

Specified by:
transform in interface Transformable
Parameters:
in - the input object to be transformed. If propertyInfo is non-null, the input object is a JavaBean property value.
toClass - the target class to be transformed to.
propertyInfo - If null, it means the in object is a root level object. Otherwise, propertyInfo contains information about the input object as a java bean property value to be transformed.
Returns:
the transformed object.