net.sf.morph.transform
Interface DecoratedConverter

All Superinterfaces:
net.sf.composite.Component, Converter, DecoratedTransformer, ExplicitTransformer, Transformer
All Known Implementing Classes:
ArbitraryObjectMappingConverter, ArbitraryTypeMappingConverter, ArrayCopier, AssemblerCopier, BasePropertyNameCopier, BaseToPrettyTextConverter, BeanToPrettyTextConverter, BeanUtilsConverter, BeanUtilsConverter, BooleanToTextConverter, ChainedTransformer, CombiningCopier, ConditionalCopier, ConstantConverter, ContainerCopier, ContainerOfBeansCopier, ContainerToPrettyTextConverter, ContainerToTraverserConverter, ConverterDecorator, CopierDecorator, CumulativeCopier, DefaultToBooleanConverter, DefaultToTextConverter, DisassemblerCopier, EvaluateExpressionConverter, IdentityConverter, ImmutableComponentArrayCopier, ImmutableTypesOnlyIdentityConverter, MapCopier, MultipleDestinationConverter, NOPCopier, NullConverter, NumberConverter, NumberToBooleanConverter, NumberToTextConverter, NumberToTimeConverter, ObjectToBooleanConverter, ObjectToClassConverter, ObjectToPrettyTextConverter, ObjectToTextConverter, PrimitiveWrapperConverter, PropertyExpressionMappingCopier, PropertyNameMappingCopier, PropertyNameMatchingCopier, SetExpressionCopier, SimpleDelegatingTransformer, TextConverter, TextToBooleanConverter, TextToClassConverter, TextToContainerCopier, TextToNumberConverter, TextToTimeConverter, TimeConverter, TimeToNumberConverter, TimeToTextConverter, TransformerToDecoratedConverterAdapter, TypeChangingGraphTransformer

public interface DecoratedConverter
extends Converter, DecoratedTransformer

An extension of the Converter interface that defines a few more convenient methods. All methods specified in this interface can be easily implemented using just the methods in the Converter interface. Thus, if you are defining your own converter you should implement only the Converter interface. If you extend from net.sf.morph.transform.converters.BaseConverter, your converter will implement this inteface automatically. If you don't want to extend from BaseConverter, you can still easily expose this interface by using the ConverterDecorator.

You should not directly implement this interface, because additional methods may be introduced in later versions of Morph. Instead, implement the Converter interface and use the ConverterDecorator to expose this interface.

Since:
Dec 2, 2004
Author:
Matt Sgarlata

Field Summary
 
Fields inherited from interface net.sf.morph.transform.Transformer
TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY
 
Fields inherited from interface net.sf.morph.transform.Transformer
TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY
 
Method Summary
 java.lang.Object convert(java.lang.Class destinationClass, java.lang.Object source)
          Converts the given source into an object of class destinationClass.
 boolean equals(java.lang.Object object1, java.lang.Object object2)
          Tests if object1 and object2 are equivalent with respect to this converter.
 boolean equals(java.lang.Object object1, java.lang.Object object2, java.util.Locale locale)
          Tests if object1 and object2 are equivalent with respect to this converter.
 
Methods inherited from interface net.sf.morph.transform.Converter
convert
 
Methods inherited from interface net.sf.morph.transform.Transformer
getDestinationClasses, getSourceClasses
 
Methods inherited from interface net.sf.morph.transform.Transformer
getDestinationClasses, getSourceClasses
 
Methods inherited from interface net.sf.morph.transform.ExplicitTransformer
isTransformable
 

Method Detail

convert

java.lang.Object convert(java.lang.Class destinationClass,
                         java.lang.Object source)
                         throws TransformationException
Converts the given source into an object of class destinationClass. The returned object may be a reference to source itself. This isn't an issue for immutable classes (String, Long, etc) but is an issue for Collection and Array types. Equivalent to calling convert(destinationClass, source, Locale.getDefault()).

Parameters:
destinationClass - the destination class to test
source - the source object to test
Returns:
the result of the conversion
Throws:
TransformationException - if destinationClass is null, an error occurred while performing the conversion

equals

boolean equals(java.lang.Object object1,
               java.lang.Object object2,
               java.util.Locale locale)
               throws TransformationException
Tests if object1 and object2 are equivalent with respect to this converter. Specifically, this method returns true if either object1 can be converted to object2 or object2 can be converted to object1.

Parameters:
object1 - the first object to test for equality
object2 - the second object to test for equality
locale - the locale in which conversions take place
Throws:
TransformationException - if an error occurred while performing the conversions

equals

boolean equals(java.lang.Object object1,
               java.lang.Object object2)
               throws TransformationException
Tests if object1 and object2 are equivalent with respect to this converter. Specifically, this method returns true if either object1 can be converted to object2 or object2 can be converted to object1. Equivalent to calling equals(object, object2, Locale.getDefault).

Parameters:
object1 - the first object to test for equality
object2 - the second object to test for equality
Throws:
TransformationException - if an error occurred while performing the conversions


Copyright © 2004-2008.