- java.lang.Object
-
- com.remondis.remap.ReassignTransformation
-
- com.remondis.remap.MapTransformation
-
public class MapTransformation extends ReassignTransformation
The map transformation is the simplest mapping operation. It just reassigns a field from the source object to a destination object while the property name AND [ types are equal OR a matching mapper is registered on the parent mapper ]. Therefore the mapping transformation is a special case ofReassignTransformation. This mapping transformation is only used internally to distinguish from mappings configured by the user and implicit field mappings created by the mapper itself.
-
-
Field Summary
Fields Modifier and Type Field Description protected PropertyDescriptordestinationPropertyprotected MappingConfiguration<?,?>mappingprotected PropertyDescriptorsourceProperty
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetDestinationPropertyName()protected Class<?>getDestinationType()StringgetSourcePropertyName()protected Class<?>getSourceType()inthashCode()<S,T>
booleanhasMapperFor(Class<S> sourceType, Class<T> destinationType)Checks if the specified mapper is registered.voidperformTransformation(Object source, Object destination)Performs the transformation for the specified source and destination.protected ObjectreadOrFail(PropertyDescriptor property, Object source)StringtoString()protected voidwriteOrFail(PropertyDescriptor property, Object source, Object value)-
Methods inherited from class com.remondis.remap.ReassignTransformation
isEqualTypes, performTransformation, performValueTransformation, toString, validateTransformation
-
-
-
-
Field Detail
-
sourceProperty
protected PropertyDescriptor sourceProperty
-
destinationProperty
protected PropertyDescriptor destinationProperty
-
mapping
protected MappingConfiguration<?,?> mapping
-
-
Method Detail
-
toString
public String toString()
-
getDestinationPropertyName
public String getDestinationPropertyName()
- Returns:
- Returns the destination property name.
-
getSourcePropertyName
public String getSourcePropertyName()
- Returns:
- Returns the source property name. This might be a property path, if the transformation operates on property paths like PropertyPathTransformation.
-
getDestinationType
protected Class<?> getDestinationType()
-
getSourceType
protected Class<?> getSourceType()
-
readOrFail
protected Object readOrFail(PropertyDescriptor property, Object source)
-
writeOrFail
protected void writeOrFail(PropertyDescriptor property, Object source, Object value)
-
performTransformation
public void performTransformation(Object source, Object destination) throws MappingException
Performs the transformation for the specified source and destination.- Parameters:
source- The source objectdestination- The destination object.- Throws:
MappingException- Thrown on any transformation error.
-
hasMapperFor
public <S,T> boolean hasMapperFor(Class<S> sourceType, Class<T> destinationType)
Checks if the specified mapper is registered.- Parameters:
sourceType- The source typedestinationType- the destination type- Returns:
- Returns
trueif a mapper was registered for this type of conversion. Otherwisefalseis returned.
-
-