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,
List<Type> exceptionTypes,
Types typeUtils) |
static SourceMethod |
forMethodRequiringImplementation(ExecutableElement executable,
List<Parameter> parameters,
Type returnType,
List<Type> exceptionTypes,
Map<String,List<Mapping>> mappings,
IterableMapping iterableMapping,
MapMapping mapMapping,
Types typeUtils,
Messager messager,
TypeFactory typeFactory) |
static SourceMethod |
forReferencedMethod(Type declaringMapper,
ExecutableElement executable,
List<Parameter> parameters,
Type returnType,
List<Type> exceptionTypes,
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() |
List<Mapping> |
getMappingBySourcePropertyName(String sourcePropertyName)
Returns the
Mappings for the given source property. |
Map<String,List<Mapping>> |
getMappings() |
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()
Returns the type of the result.
|
Type |
getReturnType()
Returns the return type of the method
|
Mapping |
getSingleMappingByTargetPropertyName(String targetPropertyName) |
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() |
List<Type> |
getThrownTypes()
Returns all exceptions thrown by this 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.
|
void |
mergeWithInverseMappings(SourceMethod inverseMethod)
Merges in all the mappings configured via the given inverse mapping method, giving the locally defined mappings
precedence.
|
boolean |
overridesMethod()
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, List<Type> exceptionTypes, Map<String,List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping, Types typeUtils, Messager messager, TypeFactory typeFactory)
public static SourceMethod forReferencedMethod(Type declaringMapper, ExecutableElement executable, List<Parameter> parameters, Type returnType, List<Type> exceptionTypes, Types typeUtils)
public static SourceMethod forFactoryMethod(Type declaringMapper, ExecutableElement executable, Type returnType, List<Type> exceptionTypes, Types typeUtils)
public Type getDeclaringMapper()
Mapper#users(). MethodgetDeclaringMapper in interface Methodpublic ExecutableElement getExecutable()
getExecutable in interface Methodpublic List<Parameter> getParameters()
Method.getSourceParameters() this method returns all parameters MethodgetParameters in interface Methodpublic List<Parameter> getSourceParameters()
Method.getTargetParameter(). MethodgetSourceParameters in interface Methodpublic List<String> getParameterNames()
getParameterNames in interface Methodpublic Type getResultType()
MethodMappingTarget,
or in absence the return type.getResultType in interface Methodpublic 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 target property name. Only for enum mapping
methods a target will be mapped by several sources.public Mapping getSingleMappingByTargetPropertyName(String targetPropertyName)
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 List<Mapping> getMappingBySourcePropertyName(String sourcePropertyName)
Mappings for the given source property.sourcePropertyName - the source property namepublic boolean overridesMethod()
overridesMethod in interface Methodpublic boolean matches(List<Type> sourceTypes, Type targetType)
Methodpublic static boolean containsTargetTypeParameter(List<Parameter> parameters)
parameters - the parameter list to checktrue if the parameter list contains a parameter annotated with @TargetTypepublic List<Type> getThrownTypes()
MethodgetThrownTypes in interface Methodpublic void mergeWithInverseMappings(SourceMethod inverseMethod)
Copyright © 2012-2014. All Rights Reserved.