public class SourceMethod extends Object implements Method
A method can either be configured by itself or by another method for the inverse mapping direction (the appropriate
setter on MappingOptions
will be called in this case).
Modifier and Type | Class and Description |
---|---|
static class |
SourceMethod.Builder |
Modifier and Type | Method and Description |
---|---|
boolean |
canInheritFrom(SourceMethod method) |
static boolean |
containsTargetTypeParameter(List<Parameter> parameters) |
Accessibility |
getAccessibility()
Returns the
Accessibility of this method. |
List<SourceMethod> |
getApplicablePrototypeMethods() |
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() . |
Type |
getDefiningType() |
ExecutableElement |
getExecutable() |
MapperConfiguration |
getMapperConfiguration() |
List<Mapping> |
getMappingBySourcePropertyName(String sourcePropertyName)
Returns the
Mapping s for the given source property. |
MappingOptions |
getMappingOptions() |
Parameter |
getMappingTargetParameter()
Returns the parameter designated as mapping target (if present)
MappingTarget |
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.getMappingTargetParameter() . |
Parameter |
getTargetTypeParameter()
Returns the parameter designated as target type (if present)
TargetType |
List<Type> |
getThrownTypes()
Returns all exceptions thrown by this method
|
boolean |
isAfterMappingMethod() |
boolean |
isBeforeMappingMethod() |
boolean |
isDefault()
Whether this method is Java 8 default method
|
boolean |
isEnumMapping() |
boolean |
isIterableMapping() |
boolean |
isLifecycleCallbackMethod() |
boolean |
isMapMapping() |
boolean |
isSame(SourceMethod method) |
boolean |
isStatic()
Whether this method is static or an instance method
|
boolean |
isUpdateMethod() |
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 |
overridesMethod()
Whether an implementation of this method must be generated or not.
|
boolean |
reverses(SourceMethod method) |
String |
toString() |
public Type getDeclaringMapper()
Mapper#users()
. Method
getDeclaringMapper
in interface Method
public ExecutableElement getExecutable()
getExecutable
in interface Method
public List<Parameter> getParameters()
Method.getSourceParameters()
this method returns all parameters Method
getParameters
in interface Method
public List<Parameter> getSourceParameters()
Method.getMappingTargetParameter()
. Method
getSourceParameters
in interface Method
public List<String> getParameterNames()
getParameterNames
in interface Method
public Type getResultType()
Method
MappingTarget
, or in absence the return type.getResultType
in interface Method
public Type getReturnType()
Method
getReturnType
in interface Method
public Accessibility getAccessibility()
Method
Accessibility
of this method.getAccessibility
in interface Method
Accessibility
of this methodpublic Mapping getSingleMappingByTargetPropertyName(String targetPropertyName)
public boolean reverses(SourceMethod method)
public boolean isSame(SourceMethod method)
public boolean canInheritFrom(SourceMethod method)
public Parameter getMappingTargetParameter()
Method
MappingTarget
getMappingTargetParameter
in interface Method
public Parameter getTargetTypeParameter()
Method
TargetType
getTargetTypeParameter
in interface Method
public boolean isIterableMapping()
public boolean isMapMapping()
public boolean isEnumMapping()
public List<Mapping> getMappingBySourcePropertyName(String sourcePropertyName)
Mapping
s for the given source property.sourcePropertyName
- the source property namepublic List<SourceMethod> getApplicablePrototypeMethods()
public boolean overridesMethod()
overridesMethod
in interface Method
public boolean matches(List<Type> sourceTypes, Type targetType)
Method
public static boolean containsTargetTypeParameter(List<Parameter> parameters)
parameters
- the parameter list to checktrue
if the parameter list contains a parameter annotated with @TargetType
public List<Type> getThrownTypes()
Method
getThrownTypes
in interface Method
public MappingOptions getMappingOptions()
public boolean isStatic()
Method
public boolean isDefault()
Method
public Type getDefiningType()
getDefiningType
in interface Method
public MapperConfiguration getMapperConfiguration()
getMapperConfiguration
in interface Method
public boolean isLifecycleCallbackMethod()
isLifecycleCallbackMethod
in interface Method
true
, if the method represents a mapping lifecycle callback (Before/After mapping method)public boolean isAfterMappingMethod()
public boolean isBeforeMappingMethod()
public boolean isUpdateMethod()
isUpdateMethod
in interface Method
true
, if the method is an update method, i.e. it has a parameter annotated with
@MappingTarget
.Copyright © 2012-2015 Gunnar Morling; All rights reserved. Released under the Apache Software License 2.0.