A - B - public class NullFilter<A,B> extends CustomFilter<A,B>
CustomFilter.MappedTypePairHolder<A,B>| Constructor and Description |
|---|
NullFilter() |
| Modifier and Type | Method and Description |
|---|---|
<D extends B> |
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 extends A> |
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.
|
<S extends A,D extends B> |
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. |
appliesTo, getAType, getBType, inferTypespublic 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.
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.
public <S extends A,D extends B> 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.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 extends B> 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.
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 extends A> 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.
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 © 2016 Glasnost. All rights reserved.