Constructor and Description |
---|
ForgedMethod(String name,
ForgedMethod forgedMethod)
creates a new ForgedMethod with the same arguments but with a new name
|
ForgedMethod(String name,
Type sourceType,
Type returnType,
MapperConfiguration mapperConfiguration,
ExecutableElement positionHintElement,
List<Parameter> additionalParameters,
ParameterProvidedMethods parameterProvidedMethods)
Creates a new forged method with the given name.
|
ForgedMethod(String name,
Type sourceType,
Type returnType,
MapperConfiguration mapperConfiguration,
ExecutableElement positionHintElement,
List<Parameter> additionalParameters,
ParameterProvidedMethods parameterProvidedMethods,
ForgedMethodHistory history,
MappingOptions mappingOptions,
boolean forgedNameBased)
Creates a new forged method with the given name.
|
Modifier and Type | Method and Description |
---|---|
void |
addThrownTypes(List<Type> thrownTypesToAdd) |
boolean |
equals(Object o) |
Accessibility |
getAccessibility()
Returns the
Accessibility of this method. |
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() |
ForgedMethodHistory |
getHistory() |
MapperConfiguration |
getMapperConfiguration() |
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
|
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
|
int |
hashCode() |
boolean |
isDefault()
Whether this method is Java 8 default method
|
boolean |
isForgedNamedBased() |
boolean |
isLifecycleCallbackMethod() |
boolean |
isObjectFactory()
object factory mechanism not supported for forged methods
|
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 this method overrides an abstract method.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isMappingTargetAssignableToReturnType
public ForgedMethod(String name, Type sourceType, Type returnType, MapperConfiguration mapperConfiguration, ExecutableElement positionHintElement, List<Parameter> additionalParameters, ParameterProvidedMethods parameterProvidedMethods)
name
- the (unique name) for this methodsourceType
- the source typereturnType
- the return type.mapperConfiguration
- the mapper configurationpositionHintElement
- element used to for reference to the position in the source file.additionalParameters
- additional parameters to add to the forged methodparameterProvidedMethods
- additional factory/lifecycle methods to consider that are provided by context
parameterspublic ForgedMethod(String name, Type sourceType, Type returnType, MapperConfiguration mapperConfiguration, ExecutableElement positionHintElement, List<Parameter> additionalParameters, ParameterProvidedMethods parameterProvidedMethods, ForgedMethodHistory history, MappingOptions mappingOptions, boolean forgedNameBased)
name
- the (unique name) for this methodsourceType
- the source typereturnType
- the return type.mapperConfiguration
- the mapper configurationpositionHintElement
- element used to for reference to the position in the source file.additionalParameters
- additional parameters to add to the forged methodparameterProvidedMethods
- additional factory/lifecycle methods to consider that are provided by context
parametershistory
- a parent forged method if this is a forged method within a forged methodmappingOptions
- the mapping options for this methodforgedNameBased
- forges a name based (matched) mapping methodpublic ForgedMethod(String name, ForgedMethod forgedMethod)
name
- the new nameforgedMethod
- existing forge methodpublic boolean matches(List<Type> sourceTypes, Type targetType)
Method
public Type getDeclaringMapper()
Method
Mapper#users()
.getDeclaringMapper
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 Parameter getMappingTargetParameter()
Method
MappingTarget
getMappingTargetParameter
in interface Method
public Parameter getTargetTypeParameter()
Method
TargetType
getTargetTypeParameter
in interface Method
public Accessibility getAccessibility()
Method
Accessibility
of this method.getAccessibility
in interface Method
Accessibility
of this methodpublic Type getReturnType()
Method
getReturnType
in interface Method
public List<Type> getThrownTypes()
Method
getThrownTypes
in interface Method
public ForgedMethodHistory getHistory()
public boolean isForgedNamedBased()
public Type getResultType()
Method
MappingTarget
, or in absence the return type.getResultType
in interface Method
public List<String> getParameterNames()
getParameterNames
in interface Method
public boolean overridesMethod()
Method
overridesMethod
in interface Method
public ExecutableElement getExecutable()
getExecutable
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 isStatic()
Method
public boolean isDefault()
Method
public Type getDefiningType()
getDefiningType
in interface Method
public MapperConfiguration getMapperConfiguration()
getMapperConfiguration
in interface Method
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 isObjectFactory()
isObjectFactory
in interface Method
public MappingOptions getMappingOptions()
getMappingOptions
in interface Method
Copyright © 2012-2019 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.