|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.util.TransformerUtils
public abstract class TransformerUtils
Utility functions for implementing and using Transformers.
Constructor Summary | |
---|---|
TransformerUtils()
|
Method Summary | |
---|---|
static java.lang.Class[] |
getDestinationClasses(Transformer transformer,
java.lang.Class sourceType)
Get the set of destination classes available from the specified Transformer for the specified source type. |
static java.lang.Class[] |
getDestinationClassIntersection(Transformer[] transformers)
Get the set of destination classes common to all specified Transformers. |
static java.lang.Class |
getMappedDestinationType(java.util.Map typeMapping,
java.lang.Class requestedType)
Get the mapped destination type from the specified typemap. |
static java.lang.Class[] |
getSourceClasses(Transformer transformer,
java.lang.Class destinationType)
Get the set of source classes available from the specified Transformer for the specified destination type. |
static java.lang.Class[] |
getSourceClassIntersection(Transformer[] transformers)
Get the set of source classes common to all specified Transformers. |
static boolean |
isImplicitlyTransformable(Transformer transformer,
java.lang.Class destinationClass,
java.lang.Class sourceClass)
Learn whether sourceClass is transformable to destinationClass
by transformer considering only source and destination types. |
static boolean |
isImpreciseTransformation(Transformer transformer,
java.lang.Class destinationClass,
java.lang.Class sourceClass)
Learn whether transformer 's transformation
of sourceClass to destinationClass might yield an imprecise result. |
static boolean |
isTransformable(Transformer transformer,
java.lang.Class destinationClass,
java.lang.Class sourceClass)
Learn whether sourceClass is transformable to destinationClass
by transformer by implicit or explicit rules. |
static java.lang.Object |
transform(Transformer transformer,
java.lang.Class destinationType,
java.lang.Object destination,
java.lang.Object source,
java.util.Locale locale,
java.lang.Integer preferredTransformationType)
Performs a transformation of one object graph into another object graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransformerUtils()
Method Detail |
---|
public static boolean isImplicitlyTransformable(Transformer transformer, java.lang.Class destinationClass, java.lang.Class sourceClass)
sourceClass
is transformable to destinationClass
by transformer
considering only source and destination types.
transformer
- destinationClass
- sourceClass
-
public static boolean isTransformable(Transformer transformer, java.lang.Class destinationClass, java.lang.Class sourceClass)
sourceClass
is transformable to destinationClass
by transformer
by implicit or explicit rules.
transformer
- destinationClass
- sourceClass
-
isImplicitlyTransformable(Transformer, Class, Class)
,
ExplicitTransformer
public static boolean isImpreciseTransformation(Transformer transformer, java.lang.Class destinationClass, java.lang.Class sourceClass)
transformer
's transformation
of sourceClass
to destinationClass
might yield an imprecise result.
transformer
- destinationClass
- sourceClass
-
ImpreciseTransformer
public static java.lang.Object transform(Transformer transformer, java.lang.Class destinationType, java.lang.Object destination, java.lang.Object source, java.util.Locale locale, java.lang.Integer preferredTransformationType) throws TransformationException
destinationType
- the type of the root node of the destination object graphthe
- optional root node of the destination object graph. If this
parameter is specified, it will be possible to copy
information to an existing object graph rather than requiring
a new object graph be createdsource
- the root node of the source object graphlocale
- the locale in which any needed transformations should take
placepreferredTransformationType
- the preferred type of transformation to be performed
TransformationException
- if the graph could not be transformed for some reasonTransformer.TRANSFORMATION_TYPE_CONVERT
,
Transformer.TRANSFORMATION_TYPE_COPY
public static java.lang.Class getMappedDestinationType(java.util.Map typeMapping, java.lang.Class requestedType)
typeMapping
- MaprequestedType
- Class
public static java.lang.Class[] getSourceClasses(Transformer transformer, java.lang.Class destinationType)
transformer
- destinationType
-
public static java.lang.Class[] getDestinationClasses(Transformer transformer, java.lang.Class sourceType)
transformer
- sourceType
-
public static java.lang.Class[] getSourceClassIntersection(Transformer[] transformers)
transformers
-
public static java.lang.Class[] getDestinationClassIntersection(Transformer[] transformers)
transformers
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |