- java.lang.Object
-
- com.remondis.remap.MappingModel.TransformationSearchResult
-
- All Implemented Interfaces:
Iterable<MappingModel.TransformationSearchResult>
- Enclosing class:
- MappingModel<S,D>
public class MappingModel.TransformationSearchResult extends Object implements Iterable<MappingModel.TransformationSearchResult>
Represents the search results, when inspecting theMappingModel.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertyDescriptorgetDestination()StringgetDestinationPropertyName()Mapper<?,?>getMapperFor(Class<?> sourceType, Class<?> destinationType)Returns aMapperif the specified type mapping was registered on the mapper.PropertyDescriptorgetSource()StringgetSourcePropertyName()booleanhasMapperFor(Class<?> sourceType, Class<?> targetType)Checks if the mapping configuration has a mapper registered for the specified type mapping.booleanhasMultipleResults()booleanhasResult()booleanhasSingleResult()booleanisDelegatingTransformation()Checks if this transformation is likely to delegate to nested mappers.booleanisObjectTransformation()Checks if the matching transformation is a source object transformation.booleanisValueTransformation()Checks if the matching transformation is a value transformation.Iterator<MappingModel.TransformationSearchResult>iterator()MappedResultperformValueTransformation(Object value)Performs a value transformation.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
iterator
public Iterator<MappingModel.TransformationSearchResult> iterator()
- Specified by:
iteratorin interfaceIterable<MappingModel.TransformationSearchResult>
-
hasResult
public boolean hasResult()
- Returns:
- Returns
trueif the search has a result,falseotherwise.
-
hasSingleResult
public boolean hasSingleResult()
- Returns:
- Returns
trueif the search has exactly one result,falseotherwise.
-
hasMultipleResults
public boolean hasMultipleResults()
- Returns:
- Returns
trueif the search has multiple results,falseotherwise.
-
isValueTransformation
public boolean isValueTransformation()
Checks if the matching transformation is a value transformation. Note: There are also transformations that use the whole source object for mapping. In this case useisObjectTransformation()to determine source object transformations. This method expects a single search result, usehasSingleResult()before calling this method.- Returns:
- Returns
trueif the transformation expects a single field value, otherwisefalseis returned.
-
isObjectTransformation
public boolean isObjectTransformation()
Checks if the matching transformation is a source object transformation. This method expects a single search result, usehasSingleResult()before calling this method.- Returns:
- Returns
trueif the transformation expects the whole source object for mapping, otherwisefalseis returned.
-
isDelegatingTransformation
public boolean isDelegatingTransformation()
Checks if this transformation is likely to delegate to nested mappers. Note: This method expects a single search result, usehasSingleResult()before calling this method.- Returns:
- Returns
trueif the transformation will delegate to nested mappers, otherwisefalseis returned.
-
hasMapperFor
public boolean hasMapperFor(Class<?> sourceType, Class<?> targetType)
Checks if the mapping configuration has a mapper registered for the specified type mapping.- Parameters:
sourceType- The source type.targetType- The destination type.- Returns:
- Returns
trueif the mapping configuration has a mapper for the specified type mapping, otherwisefalseis returned.
-
getMapperFor
public Mapper<?,?> getMapperFor(Class<?> sourceType, Class<?> destinationType)
Returns aMapperif the specified type mapping was registered on the mapper.- Parameters:
sourceType- The source type.destinationType- The destination type.- Returns:
- Returns a
Mapperif registered. - Throws:
IllegalStateException- If the mapper cannot be found. To avoid this, check withhasMapperFor(Class, Class)before.
-
performValueTransformation
public MappedResult performValueTransformation(Object value)
Performs a value transformation. This method expects a single search result, usehasSingleResult()before calling this method.- Parameters:
value- The value to map. UseisObjectTransformation()to determine which input value is to be used.- Returns:
- Returns the
MappedResult.
-
getSourcePropertyName
public String getSourcePropertyName()
- Returns:
- Returns the source property name.
-
getDestinationPropertyName
public String getDestinationPropertyName()
- Returns:
- Returns the destination property name.
-
getSource
public PropertyDescriptor getSource()
- Returns:
- Returns the source property descriptor.
-
getDestination
public PropertyDescriptor getDestination()
- Returns:
- Returns the destination property descriptor.
-
-