public class SourceMethod extends java.lang.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(java.util.List<Parameter> parameters) |
static SourceMethod |
forFactoryMethod(Type declaringMapper,
javax.lang.model.element.ExecutableElement executable,
Type returnType,
java.util.List<Type> exceptionTypes,
javax.lang.model.util.Types typeUtils) |
static SourceMethod |
forMethodRequiringImplementation(javax.lang.model.element.ExecutableElement executable,
java.util.List<Parameter> parameters,
Type returnType,
java.util.List<Type> exceptionTypes,
java.util.Map<java.lang.String,java.util.List<Mapping>> mappings,
IterableMapping iterableMapping,
MapMapping mapMapping,
javax.lang.model.util.Types typeUtils) |
static SourceMethod |
forReferencedMethod(Type declaringMapper,
javax.lang.model.element.ExecutableElement executable,
java.util.List<Parameter> parameters,
Type returnType,
java.util.List<Type> exceptionTypes,
javax.lang.model.util.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(). |
javax.lang.model.element.ExecutableElement |
getExecutable() |
IterableMapping |
getIterableMapping() |
MapMapping |
getMapMapping() |
Mapping |
getMappingByTargetPropertyName(java.lang.String targetPropertyName)
Returns the
Mapping for the given target property. |
java.util.Map<java.lang.String,java.util.List<Mapping>> |
getMappings()
Returns the
Mappings configured for this method, keyed by source property name. |
java.lang.String |
getName()
Returns then name of the method.
|
java.util.List<java.lang.String> |
getParameterNames() |
java.util.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(java.lang.String sourceParameterName) |
java.util.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() |
java.util.List<Type> |
getThrownTypes()
Returns all exceptions thrown by this method
|
boolean |
isConfiguredByReverseMappingMethod()
Whether this method is configured by itself or by the corresponding reverse mapping method.
|
boolean |
isEnumMapping() |
boolean |
isIterableMapping() |
boolean |
isMapMapping() |
boolean |
matches(java.util.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(java.util.Map<java.lang.String,java.util.List<Mapping>> mappings) |
java.lang.String |
toString() |
public static SourceMethod forMethodRequiringImplementation(javax.lang.model.element.ExecutableElement executable, java.util.List<Parameter> parameters, Type returnType, java.util.List<Type> exceptionTypes, java.util.Map<java.lang.String,java.util.List<Mapping>> mappings, IterableMapping iterableMapping, MapMapping mapMapping, javax.lang.model.util.Types typeUtils)
public static SourceMethod forReferencedMethod(Type declaringMapper, javax.lang.model.element.ExecutableElement executable, java.util.List<Parameter> parameters, Type returnType, java.util.List<Type> exceptionTypes, javax.lang.model.util.Types typeUtils)
public static SourceMethod forFactoryMethod(Type declaringMapper, javax.lang.model.element.ExecutableElement executable, Type returnType, java.util.List<Type> exceptionTypes, javax.lang.model.util.Types typeUtils)
public Type getDeclaringMapper()
Mapper#users(). MethodgetDeclaringMapper in interface Methodpublic javax.lang.model.element.ExecutableElement getExecutable()
public java.lang.String getName()
Methodpublic java.util.List<Parameter> getParameters()
Method.getSourceParameters() this method returns all parameters MethodgetParameters in interface Methodpublic java.util.List<Parameter> getSourceParameters()
Method.getTargetParameter(). MethodgetSourceParameters in interface Methodpublic java.util.List<java.lang.String> getParameterNames()
public Type getResultType()
public Type getReturnType()
MethodgetReturnType in interface Methodpublic Accessibility getAccessibility()
MethodAccessibility of this method.getAccessibility in interface MethodAccessibility of this methodpublic java.util.Map<java.lang.String,java.util.List<Mapping>> getMappings()
Mappings configured for this method, keyed by source property name.public void setMappings(java.util.Map<java.lang.String,java.util.List<Mapping>> mappings)
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 java.lang.String toString()
toString in class java.lang.Objectpublic Mapping getMappingByTargetPropertyName(java.lang.String targetPropertyName)
Mapping for the given target property. May return null.public Parameter getSourceParameter(java.lang.String sourceParameterName)
public boolean requiresImplementation()
public boolean matches(java.util.List<Type> sourceTypes, Type targetType)
Methodpublic static boolean containsTargetTypeParameter(java.util.List<Parameter> parameters)
parameters - the parameter list to checktrue, iff the parameter list contains a parameter annotated with @TargetTypepublic java.util.List<Type> getThrownTypes()
MethodgetThrownTypes in interface MethodCopyright © 2012-2014. All Rights Reserved.