| Constructor and Description |
|---|
AggregateFilter(List<Filter<Object,Object>> filters)
Constructs a new Aggregate Filter composed of the provided filters
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
appliesTo(Property source,
Property destination)
This method will be called at build time to determine if this filter
should be applied to the mapping of the specified properties
|
<D> D |
filterDestination(D destinationValue,
Type<?> sourceType,
String sourceName,
Type<D> destType,
String destName,
MappingContext mappingContext)
This method is called to provide the Filter an opportunity to modify the
destination field's value in some way before it is mapped onto the
destination type.
|
boolean |
filtersDestination()
Called at code generation time to determine whether this filter modifies
the destination.
|
<S> S |
filterSource(S sourceValue,
Type<S> sourceType,
String sourceName,
Type<?> destType,
String destName,
MappingContext mappingContext)
This method is called to provide the Filter an opportunity to replace the
source field value before it is passed into the mapping code which
transforms it to the destination type.
|
boolean |
filtersSource()
Called at code generation time to determine whether this filter modifies
the source.
|
Type<Object> |
getAType() |
Type<Object> |
getBType() |
<S,D> boolean |
shouldMap(Type<S> sourceType,
String sourceName,
S source,
Type<D> destType,
String destName,
D dest,
MappingContext mappingContext)
This method is called at runtime to determine whether the mapping implied
by the field names and types should be performed; if
false
is returned, the mapping is skipped. |
public Type<Object> getAType()
getAType in interface MappedTypePair<Object,Object>public Type<Object> getBType()
getBType in interface MappedTypePair<Object,Object>public boolean appliesTo(Property source, Property destination)
Filterpublic boolean filtersSource()
FilterImplementations should not implement dynamic behavior here, as this method will most likely be called only once (at generation time) for a given Filter instance.
filtersSource in interface Filter<Object,Object>public boolean filtersDestination()
FilterImplementations should not implement dynamic behavior here, as this method will most likely be called only once (at generation time) for a given Filter instance.
filtersDestination in interface Filter<Object,Object>public <S,D> boolean shouldMap(Type<S> sourceType, String sourceName, S source, Type<D> destType, String destName, D dest, MappingContext mappingContext)
Filterfalse
is returned, the mapping is skipped.shouldMap in interface Filter<Object,Object>sourceType - the type of the source fieldsourceName - the name of the source fieldsource - the value of the source fielddestType - the type of the destination fielddestName - the name of the destination fielddest - the value of the destination fieldmappingContext - the current mapping contextpublic <D> D filterDestination(D destinationValue,
Type<?> sourceType,
String sourceName,
Type<D> destType,
String destName,
MappingContext mappingContext)
FilterNote that the return value should still be an instance of the provided destination type, else ClassCastException will likely occur.
filterDestination in interface Filter<Object,Object>destinationValue - the destination valuesourceType - the type of the source fieldsourceName - the name of the source fielddestType - the type of the destination fielddestName - the name of the destination fieldmappingContext - the current mapping contextpublic <S> S filterSource(S sourceValue,
Type<S> sourceType,
String sourceName,
Type<?> destType,
String destName,
MappingContext mappingContext)
FilterIt's recommended that the filter should return a new instance if it's necessary to modify the source, as a mapping request is not generally expected to have side effects on the source.
filterSource in interface Filter<Object,Object>sourceValue - the source valuesourceType - the type of the source fieldsourceName - the name of the source fielddestType - the type of the destination fielddestName - the name of the destination fieldmappingContext - the current mapping contextCopyright © 2019 Glasnost. All rights reserved.