org.sr.common.transformer
Interface ITransformer<E>

Type Parameters:
E - Target Transformation Type
All Known Subinterfaces:
IJSTransformer
All Known Implementing Classes:
AbstractJSTransformer, AbstractTransformer, JSTransformer

public interface ITransformer<E>

Base interface for transformer classes.

Author:
Serhat Dirik

Field Summary
static java.lang.String CLASS_HINT_ATTRIBUTE
          Results of of complex object transformations from java may need to keep source class name for back transformations.
static java.lang.String VALUE_ATTRIBUTE
          Results of complex object transformations from java may need to keep both source java class and naturally object value together with for the back transformation.
 
Method Summary
 java.util.List<java.lang.Class<?>> findConvertibles()
          Gives convertible java types
 boolean isConvertible(java.lang.Class<?> clazz)
          tells if the given class is convertible by the implementation
 boolean isConvertible(java.lang.String className)
          tells if the given class is convertible by the implementation
 java.lang.Object toJava(java.lang.Class<?> clazz, E obj)
          Transforms from target type to Java
 java.lang.Object toJava(E obj)
          Transforms from target type to Java
 E toTargetType(java.lang.Object o)
          Converts java object to targetted type
 E toTargetType(java.lang.Object o, ObjectReferenceMap referenceMap)
          Converts java object to targetted type
 

Field Detail

CLASS_HINT_ATTRIBUTE

static final java.lang.String CLASS_HINT_ATTRIBUTE
Results of of complex object transformations from java may need to keep source class name for back transformations. This constant keeps the attribute name of class name

See Also:
Constant Field Values

VALUE_ATTRIBUTE

static final java.lang.String VALUE_ATTRIBUTE
Results of complex object transformations from java may need to keep both source java class and naturally object value together with for the back transformation. This attribute keeps the value attribute name in target types

See Also:
Constant Field Values
Method Detail

toTargetType

E toTargetType(java.lang.Object o,
               ObjectReferenceMap referenceMap)
               throws TransformationException,
                      TransformationNotSupportedException
Converts java object to targetted type

Parameters:
o - source java object
referenceMap - this parameters usually created by highest level transformer to control cyclic dependencies
Returns:
targeted type
Throws:
TransformationException
TransformationNotSupportedException

toTargetType

E toTargetType(java.lang.Object o)
               throws TransformationException,
                      TransformationNotSupportedException
Converts java object to targetted type

Parameters:
o - source java object
Returns:
targeted type
Throws:
TransformationException
TransformationNotSupportedException

toJava

java.lang.Object toJava(E obj)
                        throws TransformationException,
                               TransformationNotSupportedException
Transforms from target type to Java

Parameters:
obj - source object
Returns:
java object
Throws:
TransformationException
TransformationNotSupportedException

toJava

java.lang.Object toJava(java.lang.Class<?> clazz,
                        E obj)
                        throws TransformationException,
                               TransformationNotSupportedException
Transforms from target type to Java

Parameters:
clazz - to be transformed java class
obj - source object
Returns:
java object
Throws:
TransformationException
TransformationNotSupportedException

findConvertibles

java.util.List<java.lang.Class<?>> findConvertibles()
Gives convertible java types

Returns:
list of convertible classes

isConvertible

boolean isConvertible(java.lang.Class<?> clazz)
tells if the given class is convertible by the implementation

Parameters:
clazz -
Returns:
true if convertible

isConvertible

boolean isConvertible(java.lang.String className)
tells if the given class is convertible by the implementation

Parameters:
className -
Returns:
true if convertible