public abstract class BuiltInMethod extends Object implements Method
Constructor and Description |
---|
BuiltInMethod() |
Modifier and Type | Method and Description |
---|---|
String |
describe() |
boolean |
doTypeVarsMatch(Type parameter,
Type returnType)
Analyzes the Java Generic type variables in the parameter do match the type variables in the build in method same
goes for the returnType.
|
boolean |
equals(Object obj)
equals based on class
|
Accessibility |
getAccessibility()
Returns the
Accessibility of this method. |
BuiltInConstructorFragment |
getConstructorFragment() |
String |
getContextParameter(ConversionContext conversionContext)
the conversion context is used to format an auxiliary parameter in the method call with context specific
information such as a date format.
|
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() |
BuiltInFieldReference |
getFieldReference() |
Set<Type> |
getImportTypes()
Returns the types used by this method for which import statements need to be generated.
|
Parameter |
getMappingTargetParameter()
mapping target parameter mechanism not supported for built-in methods
|
String |
getName()
Returns then name of the method.
|
MappingMethodOptions |
getOptions() |
abstract Parameter |
getParameter()
There's currently only one parameter foreseen instead of a list of parameter
|
List<String> |
getParameterNames() |
List<Parameter> |
getParameters()
In contrast to
Method.getSourceParameters() this method returns all parameters |
Type |
getResultType()
Returns the type of the result.
|
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()
target type parameter mechanism not supported for built-in methods
|
List<Type> |
getThrownTypes()
Returns all exceptions thrown by this method
|
int |
hashCode()
hashCode based on class
|
boolean |
isDefault()
Whether this method is Java 8 default method
|
boolean |
isLifecycleCallbackMethod() |
boolean |
isObjectFactory()
object factory mechanism not supported for built-in 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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getMappingSourceType, getReturnType, isMappingTargetAssignableToReturnType
public String getName()
public Set<Type> getImportTypes()
public boolean matches(List<Type> sourceTypes, Type targetType)
Default the targetType should be assignable to the returnType and the sourceType to the parameter, excluding generic type variables. When the implementor sees a need for this, this method can be overridden.
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 final Type getDeclaringMapper()
Mapper#users()
.
For built-in methods, the declaring mapper is always null
as they will be added as private methods to the
generated mapper.
getDeclaringMapper
in interface Method
null
public List<Parameter> getParameters()
Method
Method.getSourceParameters()
this method returns all parametersgetParameters
in interface Method
public Parameter getMappingTargetParameter()
getMappingTargetParameter
in interface Method
null
public Parameter getTargetTypeParameter()
getTargetTypeParameter
in interface Method
null
public boolean isObjectFactory()
isObjectFactory
in interface Method
public String getContextParameter(ConversionContext conversionContext)
conversionContext
- contextpublic int hashCode()
public boolean equals(Object obj)
public boolean doTypeVarsMatch(Type parameter, Type returnType)
parameter
- sourcereturnType
- targettrue
, iff the the type variables matchpublic abstract Parameter getParameter()
public Accessibility getAccessibility()
Method
Accessibility
of this method.getAccessibility
in interface Method
Accessibility
of this methodpublic List<Type> getThrownTypes()
Method
getThrownTypes
in interface Method
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 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 isUpdateMethod()
isUpdateMethod
in interface Method
true
, if the method is an update method, i.e. it has a parameter annotated with
@MappingTarget
.public MappingMethodOptions getOptions()
getOptions
in interface Method
public BuiltInFieldReference getFieldReference()
public BuiltInConstructorFragment getConstructorFragment()
Copyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.