public class TLcdDataTypeMapping extends Object
This class is used to build an ILcdObjectTransformation
that transforms instances
of one data object type into another data object type. This transformation transforms
source data objects into target data objects by transforming the data properties of the
source data objects one by one using ILcdDataPropertyTransformation
instances.
Constructor and Description |
---|
TLcdDataTypeMapping(TLcdDataType aSourceType,
TLcdDataType aTargetType)
Creates a new data type mapping.
|
TLcdDataTypeMapping(TLcdDataType aSourceType,
TLcdDataType aTargetType,
boolean aTransformEmptyProperties)
Creates a new data type mapping.
|
Modifier and Type | Method and Description |
---|---|
ILcdObjectTransformation |
createTransformation(TLcdObjectTransformationProvider aProvider)
Creates and returns a transformation that is capable of transforming instances of the
source type into instances of the target type.
|
TLcdDataTypeMapping |
getInverse()
Returns the inverse of this mapping.
|
TLcdDataType |
getSourceType() |
TLcdDataType |
getTargetType() |
void |
mapProperty(String aSourceProperty,
ILcdDataPropertyTransformation aTransformation)
Maps the given source property using the given transformation on the target object.
|
void |
mapProperty(String aSourceProperty,
String aTargetProperty)
Maps the source property with the given name on the target property with the given name.
|
void |
mapProperty(String aSourceProperty,
String aTargetProperty,
ILcdObjectTransformation aTransformation)
Maps the source property with the given name on the target property with the given name.
|
void |
mapProperty(TLcdDataProperty aSourceProperty,
ILcdDataPropertyTransformation aTransformation)
Maps the given source property using the given transformation on the target object.
|
void |
mapProperty(TLcdDataProperty aSourceProperty,
TLcdDataProperty aTargetProperty)
Maps the given source property on the target property.
|
void |
mapProperty(TLcdDataProperty aSourceProperty,
TLcdDataProperty aTargetProperty,
ILcdObjectTransformation aTransformation)
Maps the given source property on the given target property.
|
void |
mapTargetProperty(String aTargetProperty,
ILcdObjectTransformation aTransformation)
Maps the given target property using the given transformation.
|
void |
mapTargetProperty(TLcdDataProperty aTargetProperty,
ILcdObjectTransformation aTransformation)
Maps the given target property using the given transformation.
|
public TLcdDataTypeMapping(TLcdDataType aSourceType, TLcdDataType aTargetType)
null
value will not be transformed by default.aSourceType
- the source typeaTargetType
- the target typepublic TLcdDataTypeMapping(TLcdDataType aSourceType, TLcdDataType aTargetType, boolean aTransformEmptyProperties)
aSourceType
- the source typeaTargetType
- the target typeaTransformEmptyProperties
- indicates whether the created transformations should make an attempt
to transform properties without a value. This may be useful if
a null
value in the source data should be mapped onto
a non-null default value in the target data.public TLcdDataType getTargetType()
public TLcdDataType getSourceType()
public void mapProperty(String aSourceProperty, ILcdDataPropertyTransformation aTransformation)
aSourceProperty
- the source propertyaTransformation
- the transformation that is to be used to transform values for the given source propertypublic void mapProperty(TLcdDataProperty aSourceProperty, ILcdDataPropertyTransformation aTransformation)
aSourceProperty
- the source property to mapaTransformation
- the transformation to use to map the source propertypublic void mapProperty(String aSourceProperty, String aTargetProperty)
aSourceProperty
- the source propertyaTargetProperty
- the target propertymapProperty(TLcdDataProperty, TLcdDataProperty)
public void mapProperty(TLcdDataProperty aSourceProperty, TLcdDataProperty aTargetProperty)
aSourceProperty
- the source propertyaTargetProperty
- the target propertypublic void mapProperty(String aSourceProperty, String aTargetProperty, ILcdObjectTransformation aTransformation)
aSourceProperty
- the source propertyaTargetProperty
- the target propertyaTransformation
- the transformation used to transform source values into target valuespublic void mapProperty(TLcdDataProperty aSourceProperty, TLcdDataProperty aTargetProperty, ILcdObjectTransformation aTransformation)
aSourceProperty
- the source propertyaTargetProperty
- the target propertyaTransformation
- the transformation used to transform source values into target valuespublic void mapTargetProperty(String aTargetProperty, ILcdObjectTransformation aTransformation)
Maps the given target property using the given transformation. The transformation should transform instances of this object's source type into appropriate values for the given target property. This property mapping is always uni-directional. To make the type mapping bi-directional, additional property mappings have to be registered on this object's inverse type mapping.
This method is for instance used to map properties whose values depends on the value of multiple source properties.
aTargetProperty
- the name of the target propertyaTransformation
- the transformation used to transform a source instance into a value for the target propertypublic void mapTargetProperty(TLcdDataProperty aTargetProperty, ILcdObjectTransformation aTransformation)
Maps the given target property using the given transformation. The transformation should transform instances of this object's source type into appropriate values for the given target property.
This method is for instance used to map properties whose values depends on the value of multiple source properties.
aTargetProperty
- the target propertyaTransformation
- the transformation used to transform a source instance into a value for the target propertypublic TLcdDataTypeMapping getInverse()
public ILcdObjectTransformation createTransformation(TLcdObjectTransformationProvider aProvider)
Creates and returns a transformation that is capable of transforming instances of the source type into instances of the target type.
The returned object transformation transforms objects as follows:
type.newInstance()
.mapProperty
methods) is transformed. The order in which the property transformations
are applied is implementation dependent and should not be relied upon.aProvider
- the transformation provider