Package org.mapstruct.ap.internal.model
Class ForgedMethod
- java.lang.Object
 - 
- org.mapstruct.ap.internal.model.ForgedMethod
 
 
- 
- 
Constructor Summary
Constructors Constructor Description ForgedMethod(String name, ForgedMethod forgedMethod)creates a new ForgedMethod with the same arguments but with a new name 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddThrownTypes(List<Type> thrownTypesToAdd)Stringdescribe()booleanequals(Object o)static ForgedMethodforElementMapping(String name, Type sourceType, Type returnType, Method basedOn, ForgedMethodHistory history, boolean forgedNameBased)Creates a new forged method for mapping a collection element, map key/value or stream elementstatic ForgedMethodforParameterMapping(String name, Type sourceType, Type returnType, Method basedOn)Creates a new forged method with the given name for mapping a method parameter to a property.static ForgedMethodforPropertyMapping(String name, Type sourceType, Type returnType, List<Parameter> parameters, Method basedOn, ForgedMethodHistory history, MappingReferences mappingReferences, boolean forgedNameBased)Creates a new forged method for mapping a bean property to a propertystatic ForgedMethodforSubclassMapping(String name, Type sourceType, Type returnType, Method basedOn, MappingReferences mappingReferences, ForgedMethodHistory history, boolean forgedNameBased)Creates a new forged method for mapping a SubclassMapping elementAccessibilitygetAccessibility()Returns theAccessibilityof this method.List<Parameter>getContextParameters()returns the list of mapping context parameters, i.e. those parameters that are annotated withContext.ParameterProvidedMethodsgetContextProvidedMethods()TypegetDeclaringMapper()Returns the mapper type declaring this method if it is not declared by the mapper interface currently processed but by another mapper imported viaMapper#users().TypegetDefiningType()ExecutableElementgetExecutable()ForgedMethodHistorygetHistory()MappingReferencesgetMappingReferences()ParametergetMappingTargetParameter()Returns the parameter designated as mapping target (if present)MappingTargetStringgetName()Returns then name of the method.MappingMethodOptionsgetOptions()List<String>getParameterNames()List<Parameter>getParameters()In contrast toMethod.getSourceParameters()this method returns all parametersTypegetResultType()Returns the type of the result.TypegetReturnType()Returns the return type of the methodList<Parameter>getSourceParameters()returns the list of 'true' source parameters excluding the parameter(s) that are designated as target, target type or context parameter.ParametergetTargetTypeParameter()Returns the parameter designated as target type (if present)TargetTypeList<Type>getThrownTypes()Returns all exceptions thrown by this methodList<Type>getTypeParameters()Returns the formal type parameters of this method in declaration order.inthashCode()booleanisDefault()Whether this method is Java 8 default methodbooleanisForgedNamedBased()booleanisLifecycleCallbackMethod()booleanisObjectFactory()object factory mechanism not supported for forged methodsbooleanisStatic()Whether this method is static or an instance methodbooleanisUpdateMethod()booleanmatches(List<Type> sourceTypes, Type targetType)Checks whether the provided sourceType and provided targetType match with the parameter respectively return type of the method.booleanoverridesMethod()Whether this method overrides an abstract method.StringtoString()- 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface org.mapstruct.ap.internal.model.source.Method
getConditionOptions, getMappingSourceType, isMappingTargetAssignableToReturnType 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
ForgedMethod
public ForgedMethod(String name, ForgedMethod forgedMethod)
creates a new ForgedMethod with the same arguments but with a new name- Parameters:
 name- the new nameforgedMethod- existing forge method
 
 - 
 
- 
Method Detail
- 
forParameterMapping
public static ForgedMethod forParameterMapping(String name, Type sourceType, Type returnType, Method basedOn)
Creates a new forged method with the given name for mapping a method parameter to a property.- Parameters:
 name- the (unique name) for this methodsourceType- the source typereturnType- the return type.basedOn- the method that (originally) triggered this nested method generation.- Returns:
 - a new forge method
 
 
- 
forPropertyMapping
public static ForgedMethod forPropertyMapping(String name, Type sourceType, Type returnType, List<Parameter> parameters, Method basedOn, ForgedMethodHistory history, MappingReferences mappingReferences, boolean forgedNameBased)
Creates a new forged method for mapping a bean property to a property- Parameters:
 name- the (unique name) for this methodsourceType- the source typereturnType- the return type.parameters- other parameters (including the context + @MappingTargetbasedOn- the method that (originally) triggered this nested method generation.history- a parent forged method if this is a forged method within a forged methodmappingReferences- the mapping options for this methodforgedNameBased- forges a name based (matched) mapping method- Returns:
 - a new forge method
 
 
- 
forElementMapping
public static ForgedMethod forElementMapping(String name, Type sourceType, Type returnType, Method basedOn, ForgedMethodHistory history, boolean forgedNameBased)
Creates a new forged method for mapping a collection element, map key/value or stream element- Parameters:
 name- the (unique name) for this methodsourceType- the source typereturnType- the return type.basedOn- the method that (originally) triggered this nested method generation.history- a parent forged method if this is a forged method within a forged methodforgedNameBased- forges a name based (matched) mapping method- Returns:
 - a new forge method
 
 
- 
forSubclassMapping
public static ForgedMethod forSubclassMapping(String name, Type sourceType, Type returnType, Method basedOn, MappingReferences mappingReferences, ForgedMethodHistory history, boolean forgedNameBased)
Creates a new forged method for mapping a SubclassMapping element- Parameters:
 name- the (unique name) for this methodsourceType- the source typereturnType- the return type.basedOn- the method that (originally) triggered this nested method generation.history- a parent forged method if this is a forged method within a forged methodforgedNameBased- forges a name based (matched) mapping method- Returns:
 - a new forge method
 
 
- 
matches
public boolean matches(List<Type> sourceTypes, Type targetType)
Description copied from interface:MethodChecks whether the provided sourceType and provided targetType match with the parameter respectively return type of the method. The check also should incorporate wild card and generic type variables 
- 
getDeclaringMapper
public Type getDeclaringMapper()
Description copied from interface:MethodReturns the mapper type declaring this method if it is not declared by the mapper interface currently processed but by another mapper imported viaMapper#users().- Specified by:
 getDeclaringMapperin interfaceMethod- Returns:
 - The declaring mapper type
 
 
- 
getName
public String getName()
Description copied from interface:MethodReturns then name of the method. 
- 
getParameters
public List<Parameter> getParameters()
Description copied from interface:MethodIn contrast toMethod.getSourceParameters()this method returns all parameters- Specified by:
 getParametersin interfaceMethod- Returns:
 - all parameters
 
 
- 
getSourceParameters
public List<Parameter> getSourceParameters()
Description copied from interface:Methodreturns the list of 'true' source parameters excluding the parameter(s) that are designated as target, target type or context parameter.- Specified by:
 getSourceParametersin interfaceMethod- Returns:
 - list of 'true' source parameters
 
 
- 
getContextParameters
public List<Parameter> getContextParameters()
Description copied from interface:Methodreturns the list of mapping context parameters, i.e. those parameters that are annotated withContext.- Specified by:
 getContextParametersin interfaceMethod- Returns:
 - list of context parameters
 
 
- 
getContextProvidedMethods
public ParameterProvidedMethods getContextProvidedMethods()
- Specified by:
 getContextProvidedMethodsin interfaceMethod- Returns:
 - a mapping between 
Method.getContextParameters()to factory and lifecycle methods provided by them. 
 
- 
getMappingTargetParameter
public Parameter getMappingTargetParameter()
Description copied from interface:MethodReturns the parameter designated as mapping target (if present)MappingTarget- Specified by:
 getMappingTargetParameterin interfaceMethod- Returns:
 - mapping target parameter (when present) null otherwise.
 
 
- 
getTargetTypeParameter
public Parameter getTargetTypeParameter()
Description copied from interface:MethodReturns the parameter designated as target type (if present)TargetType- Specified by:
 getTargetTypeParameterin interfaceMethod- Returns:
 - target type parameter (when present) null otherwise.
 
 
- 
getAccessibility
public Accessibility getAccessibility()
Description copied from interface:MethodReturns theAccessibilityof this method.- Specified by:
 getAccessibilityin interfaceMethod- Returns:
 - the 
Accessibilityof this method 
 
- 
getReturnType
public Type getReturnType()
Description copied from interface:MethodReturns the return type of the method- Specified by:
 getReturnTypein interfaceMethod- Returns:
 - return type
 
 
- 
getThrownTypes
public List<Type> getThrownTypes()
Description copied from interface:MethodReturns all exceptions thrown by this method- Specified by:
 getThrownTypesin interfaceMethod- Returns:
 - exceptions thrown
 
 
- 
getHistory
public ForgedMethodHistory getHistory()
 
- 
isForgedNamedBased
public boolean isForgedNamedBased()
 
- 
getResultType
public Type getResultType()
Description copied from interface:MethodReturns the type of the result. The result is defined as the type of the parameter designated withMappingTarget, or in absence the return type.- Specified by:
 getResultTypein interfaceMethod- Returns:
 - result type
 
 
- 
getParameterNames
public List<String> getParameterNames()
- Specified by:
 getParameterNamesin interfaceMethod- Returns:
 - the names of the parameters of this mapping method
 
 
- 
overridesMethod
public boolean overridesMethod()
Description copied from interface:MethodWhether this method overrides an abstract method.- Specified by:
 overridesMethodin interfaceMethod- Returns:
 - true when an abstract method is overridden.
 
 
- 
getExecutable
public ExecutableElement getExecutable()
- Specified by:
 getExecutablein interfaceMethod
 
- 
isLifecycleCallbackMethod
public boolean isLifecycleCallbackMethod()
- Specified by:
 isLifecycleCallbackMethodin interfaceMethod- Returns:
 true, if the method represents a mapping lifecycle callback (Before/After mapping method)
 
- 
isStatic
public boolean isStatic()
Description copied from interface:MethodWhether this method is static or an instance method 
- 
isDefault
public boolean isDefault()
Description copied from interface:MethodWhether this method is Java 8 default method 
- 
getDefiningType
public Type getDefiningType()
- Specified by:
 getDefiningTypein interfaceMethod- Returns:
 - the Type (class or interface) that defines this method.
 
 
- 
isUpdateMethod
public boolean isUpdateMethod()
- Specified by:
 isUpdateMethodin interfaceMethod- Returns:
 true, if the method is an update method, i.e. it has a parameter annotated with@MappingTarget.
 
- 
isObjectFactory
public boolean isObjectFactory()
object factory mechanism not supported for forged methods- Specified by:
 isObjectFactoryin interfaceMethod- Returns:
 - false
 
 
- 
getOptions
public MappingMethodOptions getOptions()
- Specified by:
 getOptionsin interfaceMethod- Returns:
 - the mapping options for this method
 
 
- 
getTypeParameters
public List<Type> getTypeParameters()
Description copied from interface:MethodReturns the formal type parameters of this method in declaration order.- Specified by:
 getTypeParametersin interfaceMethod- Returns:
 - the formal type parameters, or an empty list if there are none
 
 
- 
describe
public String describe()
 
- 
getMappingReferences
public MappingReferences getMappingReferences()
 
 - 
 
 -