public class SourceMethod extends Object implements Method
A method can either be configured by itself or by another method for the inverse mapping direction (one of
setMappings(Map), setIterableMapping(IterableMapping) or setMapMapping(MapMapping) will be
called in this case).
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsTargetTypeParameter(List<Parameter> parameters) |
static SourceMethod |
forFactoryMethod(Type declaringMapper,
ExecutableElement executable,
Type returnType,
Types typeUtils) |
static SourceMethod |
forMethodRequiringImplementation(ExecutableElement executable,
List<Parameter> parameters,
Type returnType,
Map<String,List<Mapping>> mappings,
IterableMapping iterableMapping,
MapMapping mapMapping,
Types typeUtils) |
static SourceMethod |
forReferencedMethod(Type declaringMapper,
ExecutableElement executable,
List<Parameter> parameters,
Type returnType,
Types typeUtils) |
Accessibility |
getAccessibility()
Returns the
Accessibility of this method. |
Type |
getDeclaringMapper()
Returns the mapper type declaring this method if it is not declared by the mapper interface currently processed
but by another mapper imported via
Mapper#users(). |
ExecutableElement |
getExecutable() |
IterableMapping |
getIterableMapping() |
MapMapping |
getMapMapping() |
Mapping |
getMappingByTargetPropertyName(String targetPropertyName)
Returns the
Mapping for the given target property. |
Map<String,List<Mapping>> |
getMappings()
Returns the
Mappings configured for this method, keyed by source property name. |
String |
getName()
Returns then name of the method.
|
List<String> |
getParameterNames() |
List<Parameter> |
getParameters()
In contrast to
Method.getSourceParameters() this method returns all parameters |
Type |
getResultType() |
Type |
getReturnType()
Returns the return type of the method
|
Parameter |
getSourceParameter(String sourceParameterName) |
List<Parameter> |
getSourceParameters()
returns the list of 'true' source parameters excluding the parameter(s) that is designated as
target by means of the target annotation
Method.getTargetParameter(). |
Parameter |
getTargetParameter()
Returns the parameter designated as target parameter (if present)
Method.getSourceParameters() |
boolean |
isConfiguredByReverseMappingMethod()
Whether this method is configured by itself or by the corresponding reverse mapping method.
|
boolean |
isEnumMapping() |
boolean |
isIterableMapping() |
boolean |
isMapMapping() |
boolean |
matches(List<Type> sourceTypes,
Type targetType)
Checks whether the provided sourceType and provided targetType match with the parameter respectively return type
of the method.
|
boolean |
requiresImplementation()
Whether an implementation of this method must be generated or not.
|
boolean |
reverses(SourceMethod method) |
void |
setIterableMapping(IterableMapping iterableMapping) |
void |
setMapMapping(MapMapping mapMapping) |
void |
setMappings(Map<String,List<Mapping>> mappings) |
String |
toString() |
public static SourceMethod forMethodRequiringImplementation(ExecutableElement executable, List<Parameter> parameters, Type returnType, Map<String,List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping, Types typeUtils)
public static SourceMethod forReferencedMethod(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType, Types typeUtils)
public static SourceMethod forFactoryMethod(Type declaringMapper, ExecutableElement executable, Type returnType, Types typeUtils)
public Type getDeclaringMapper()
Mapper#users(). MethodgetDeclaringMapper in interface Methodpublic ExecutableElement getExecutable()
public List<Parameter> getParameters()
Method.getSourceParameters() this method returns all parameters MethodgetParameters in interface Methodpublic List<Parameter> getSourceParameters()
Method.getTargetParameter(). MethodgetSourceParameters in interface Methodpublic Type getResultType()
public Type getReturnType()
MethodgetReturnType in interface Methodpublic Accessibility getAccessibility()
MethodAccessibility of this method.getAccessibility in interface MethodAccessibility of this methodpublic Map<String,List<Mapping>> getMappings()
Mappings configured for this method, keyed by source property name.public IterableMapping getIterableMapping()
public void setIterableMapping(IterableMapping iterableMapping)
public MapMapping getMapMapping()
public void setMapMapping(MapMapping mapMapping)
public boolean reverses(SourceMethod method)
public Parameter getTargetParameter()
Method.getSourceParameters() MethodgetTargetParameter in interface Methodpublic boolean isIterableMapping()
public boolean isMapMapping()
public boolean isEnumMapping()
public boolean isConfiguredByReverseMappingMethod()
true if this method is configured by itself, false otherwise.public Mapping getMappingByTargetPropertyName(String targetPropertyName)
Mapping for the given target property. May return null.public boolean requiresImplementation()
public boolean matches(List<Type> sourceTypes, Type targetType)
MethodCopyright © 2012-2014. All Rights Reserved.