com.metamatrix.common.types
Class AbstractTransform

java.lang.Object
  extended by com.metamatrix.common.types.AbstractTransform
All Implemented Interfaces:
Transform
Direct Known Subclasses:
AnyToObjectTransform, AnyToStringTransform, BigDecimalToBigIntegerTransform, BigDecimalToBooleanTransform, BigDecimalToByteTransform, BigDecimalToDoubleTransform, BigDecimalToFloatTransform, BigDecimalToIntegerTransform, BigDecimalToLongTransform, BigDecimalToShortTransform, BigIntegerToBigDecimalTransform, BigIntegerToBooleanTransform, BigIntegerToByteTransform, BigIntegerToDoubleTransform, BigIntegerToFloatTransform, BigIntegerToIntegerTransform, BigIntegerToLongTransform, BigIntegerToShortTransform, BooleanToBigDecimalTransform, BooleanToBigIntegerTransform, BooleanToByteTransform, BooleanToDoubleTransform, BooleanToFloatTransform, BooleanToIntegerTransform, BooleanToLongTransform, BooleanToShortTransform, ByteToBigDecimalTransform, ByteToBigIntegerTransform, ByteToBooleanTransform, ByteToDoubleTransform, ByteToFloatTransform, ByteToIntegerTransform, ByteToLongTransform, ByteToShortTransform, DateToTimestampTransform, DoubleToBigDecimalTransform, DoubleToBigIntegerTransform, DoubleToBooleanTransform, DoubleToByteTransform, DoubleToFloatTransform, DoubleToIntegerTransform, DoubleToLongTransform, DoubleToShortTransform, FloatToBigDecimalTransform, FloatToBigIntegerTransform, FloatToBooleanTransform, FloatToByteTransform, FloatToDoubleTransform, FloatToIntegerTransform, FloatToLongTransform, FloatToShortTransform, IntegerToBigDecimalTransform, IntegerToBigIntegerTransform, IntegerToBooleanTransform, IntegerToByteTransform, IntegerToDoubleTransform, IntegerToFloatTransform, IntegerToLongTransform, IntegerToShortTransform, LongToBigDecimalTransform, LongToBigIntegerTransform, LongToBooleanTransform, LongToByteTransform, LongToDoubleTransform, LongToFloatTransform, LongToIntegerTransform, LongToShortTransform, NullToAnyTransform, ObjectToAnyTransform, ShortToBigDecimalTransform, ShortToBigIntegerTransform, ShortToBooleanTransform, ShortToByteTransform, ShortToDoubleTransform, ShortToFloatTransform, ShortToIntegerTransform, ShortToLongTransform, StringToBigDecimalTransform, StringToBigIntegerTransform, StringToBooleanTransform, StringToByteTransform, StringToCharacterTransform, StringToClobTransform, StringToDateTransform, StringToDoubleTransform, StringToFloatTransform, StringToIntegerTransform, StringToLongTransform, StringToShortTransform, StringToSQLXMLTransform, StringToTimestampTransform, StringToTimeTransform, TimestampToDateTransform, TimestampToTimeTransform, TimeToTimestampTransform

public abstract class AbstractTransform
extends java.lang.Object
implements Transform

This fills in most of the details of a Transform and provides additional helpful methods as well. Transform writers should only need to fill in getSourceType(), getTargetType(), and transform().


Constructor Summary
AbstractTransform()
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Override Object.equals() to build an equals based on src and tgt types.
 java.lang.String getDescription()
          Get description.
 java.lang.String getDisplayName()
          Get nice display name for GUIs.
abstract  java.lang.Class getSourceType()
          Type of the incoming value.
 java.lang.String getSourceTypeName()
          Name of the source type.
abstract  java.lang.Class getTargetType()
          Type of the outgoing value.
 java.lang.String getTargetTypeName()
          Name of the target type.
 int hashCode()
          Override Object.hashCode() to build a hash based on types.
 boolean isNarrowing()
          Flag if the transformation from source to target is a narrowing transformation that may lose information.
 java.lang.String toString()
          Override Object.toString() to do getDisplayName() version.
abstract  java.lang.Object transform(java.lang.Object value)
          This method transforms a value of the source type into a value of the target type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTransform

public AbstractTransform()
Method Detail

transform

public abstract java.lang.Object transform(java.lang.Object value)
                                    throws TransformationException
This method transforms a value of the source type into a value of the target type.

Specified by:
transform in interface Transform
Parameters:
value - Incoming value of source type
Returns:
Outgoing value of target type
Throws:
TransformationException - if value is an incorrect input type or the transformation fails

getSourceType

public abstract java.lang.Class getSourceType()
Type of the incoming value.

Specified by:
getSourceType in interface Transform
Returns:
Source type

getSourceTypeName

public java.lang.String getSourceTypeName()
Name of the source type.

Specified by:
getSourceTypeName in interface Transform
Returns:
Name of source type

getTargetType

public abstract java.lang.Class getTargetType()
Type of the outgoing value.

Specified by:
getTargetType in interface Transform
Returns:
Target type

getTargetTypeName

public java.lang.String getTargetTypeName()
Name of the target type.

Specified by:
getTargetTypeName in interface Transform
Returns:
Name of target type

getDisplayName

public java.lang.String getDisplayName()
Get nice display name for GUIs.

Specified by:
getDisplayName in interface Transform
Returns:
Display name

getDescription

public java.lang.String getDescription()
Get description.

Specified by:
getDescription in interface Transform
Returns:
Description of transform

isNarrowing

public boolean isNarrowing()
Flag if the transformation from source to target is a narrowing transformation that may lose information. This class returns false by default. This method should be overridden if the transform is a narrowing transform.

Specified by:
isNarrowing in interface Transform
Returns:
False unless overridden.

toString

public java.lang.String toString()
Override Object.toString() to do getDisplayName() version.

Overrides:
toString in class java.lang.Object
Returns:
String representation of object

hashCode

public int hashCode()
Override Object.hashCode() to build a hash based on types.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code

equals

public boolean equals(java.lang.Object obj)
Override Object.equals() to build an equals based on src and tgt types.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object
Returns:
True if obj==this


Copyright © 2009. All Rights Reserved.