net.sf.beanlib.spi
Class ChainedCustomBeanTransformer
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
customTransformers
private final List<CustomBeanTransformerSpi> customTransformers
ChainedCustomBeanTransformer
private ChainedCustomBeanTransformer()
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 objecttoClass
- target classpropertyInfo
- 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.