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 MappingMethodOptions
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) |
String |
describe() |
Accessibility |
getAccessibility()
Returns the
Accessibility of this method. |
List<SourceMethod> |
getApplicablePrototypeMethods() |
List<SourceMethod> |
getApplicableReversePrototypeMethods() |
List<Parameter> |
getContextParameters()
returns the list of mapping context parameters, i.e. those parameters that are annotated with
Context . |
ParameterProvidedMethods |
getContextProvidedMethods() |
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() |
Parameter |
getMappingTargetParameter()
Returns the parameter designated as mapping target (if present)
MappingTarget |
String |
getName()
Returns then name of the method.
|
MappingMethodOptions |
getOptions() |
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
|
List<Parameter> |
getSourceParameters()
returns the list of 'true' source parameters excluding the parameter(s) that are designated as target, target
type or context parameter.
|
Parameter |
getTargetTypeParameter()
Returns the parameter designated as target type (if present)
TargetType |
List<Type> |
getThrownTypes()
Returns all exceptions thrown by this method
|
boolean |
hasObjectFactoryAnnotation() |
boolean |
inverses(SourceMethod method) |
boolean |
isAbstract() |
boolean |
isAfterMappingMethod() |
boolean |
isBeforeMappingMethod() |
boolean |
isDefault()
Whether this method is Java 8 default method
|
boolean |
isIterableMapping() |
boolean |
isLifecycleCallbackMethod() |
boolean |
isMapMapping() |
boolean |
isObjectFactory()
Returns whether the meethod is designated as bean factory for
mapping target
ObjectFactory |
boolean |
isRemovedEnumMapping()
Enum Mapping was realized with @Mapping in stead of @ValueMapping.
|
boolean |
isStatic()
Whether this method is static or an instance method
|
boolean |
isStreamMapping() |
boolean |
isUpdateMethod() |
boolean |
isValueMapping()
The default enum mapping (no mappings specified) will from now on be handled as a value mapping.
|
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.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getMappingSourceType, isMappingTargetAssignableToReturnType
public Type getDeclaringMapper()
Method
Mapper#users()
.getDeclaringMapper
in interface Method
public ExecutableElement getExecutable()
getExecutable
in interface Method
public String getName()
Method
public List<Parameter> getParameters()
Method
Method.getSourceParameters()
this method returns all parametersgetParameters
in interface Method
public List<Parameter> getSourceParameters()
Method
getSourceParameters
in interface Method
public List<Parameter> getContextParameters()
Method
Context
.getContextParameters
in interface Method
public ParameterProvidedMethods getContextProvidedMethods()
getContextProvidedMethods
in interface Method
Method.getContextParameters()
to factory and lifecycle methods provided by them.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 boolean inverses(SourceMethod method)
public boolean canInheritFrom(SourceMethod method)
public Parameter getMappingTargetParameter()
Method
MappingTarget
getMappingTargetParameter
in interface Method
public boolean isObjectFactory()
Method
ObjectFactory
isObjectFactory
in interface Method
public Parameter getTargetTypeParameter()
Method
TargetType
getTargetTypeParameter
in interface Method
public boolean isIterableMapping()
public boolean isStreamMapping()
public boolean isMapMapping()
public boolean isRemovedEnumMapping()
public boolean isValueMapping()
public List<SourceMethod> getApplicablePrototypeMethods()
public List<SourceMethod> getApplicableReversePrototypeMethods()
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 MappingMethodOptions getOptions()
getOptions
in interface Method
public boolean isStatic()
Method
public boolean isDefault()
Method
public Type getDefiningType()
getDefiningType
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 isAbstract()
public boolean isUpdateMethod()
isUpdateMethod
in interface Method
true
, if the method is an update method, i.e. it has a parameter annotated with
@MappingTarget
.public boolean hasObjectFactoryAnnotation()
Copyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.