net.sf.beanlib.joda
Class JodaTimeTransformer

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

public class JodaTimeTransformer
extends Object
implements CustomBeanTransformerSpi

A simple Joda Time Transformer.

Author:
Hanson Char

Nested Class Summary
static class JodaTimeTransformer.Factory
           
 
Field Summary
private  Map<Class<?>,CustomBeanTransformerSpi> map
           
private static JodaTimeTransformer singleton
           
 
Constructor Summary
private JodaTimeTransformer()
           
 
Method Summary
 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

singleton

private static final JodaTimeTransformer singleton

map

private final Map<Class<?>,CustomBeanTransformerSpi> map
Constructor Detail

JodaTimeTransformer

private JodaTimeTransformer()
Method Detail

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.