Package org.mapstruct.ap.internal.model
Class MappingMethod
- java.lang.Object
-
- org.mapstruct.ap.internal.writer.FreeMarkerWritable
-
- org.mapstruct.ap.internal.model.common.ModelElement
-
- org.mapstruct.ap.internal.model.MappingMethod
-
- All Implemented Interfaces:
Writable
- Direct Known Subclasses:
DelegatingMethod,NestedPropertyMappingMethod,NormalTypeMappingMethod,SupportingMappingMethod,ValueMappingMethod
public abstract class MappingMethod extends ModelElement
A method implemented or referenced by aMapperclass.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.writer.Writable
Writable.Context
-
-
Field Summary
Fields Modifier and Type Field Description private Accessibilityaccessibilityprivate java.util.List<LifecycleCallbackMethodReference>afterMappingReferencesprivate java.util.List<LifecycleCallbackMethodReference>beforeMappingReferencesWithMappingTargetprivate java.util.List<LifecycleCallbackMethodReference>beforeMappingReferencesWithoutMappingTargetprivate booleanisStaticprivate java.lang.Stringnameprivate java.util.List<Parameter>parametersprivate java.lang.StringresultNameprivate TypereturnTypeprivate java.util.List<Parameter>sourceParametersprivate ParametertargetParameterprivate java.util.List<Type>thrownTypes
-
Constructor Summary
Constructors Modifier Constructor Description protectedMappingMethod(Method method)protectedMappingMethod(Method method, java.util.Collection<java.lang.String> existingVariableNames, java.util.List<LifecycleCallbackMethodReference> beforeMappingReferences, java.util.List<LifecycleCallbackMethodReference> afterMappingReferences)constructor to be overloaded when local variable names are required prior to calling this constructor.protectedMappingMethod(Method method, java.util.List<Parameter> parameters)protectedMappingMethod(Method method, java.util.List<Parameter> parameters, java.util.Collection<java.lang.String> existingVariableNames, java.util.List<LifecycleCallbackMethodReference> beforeMappingReferences, java.util.List<LifecycleCallbackMethodReference> afterMappingReferences)protectedMappingMethod(Method method, java.util.List<LifecycleCallbackMethodReference> beforeMappingReferences, java.util.List<LifecycleCallbackMethodReference> afterMappingReferences)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)private java.util.List<LifecycleCallbackMethodReference>filterMappingTarget(java.util.List<LifecycleCallbackMethodReference> methods, boolean mustHaveMappingTargetParameter)AccessibilitygetAccessibility()java.util.List<LifecycleCallbackMethodReference>getAfterMappingReferences()java.util.List<LifecycleCallbackMethodReference>getBeforeMappingReferencesWithMappingTarget()java.util.List<LifecycleCallbackMethodReference>getBeforeMappingReferencesWithoutMappingTarget()java.util.Set<Type>getImportTypes()Returns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.java.lang.StringgetName()protected java.util.List<java.lang.String>getParameterNames()java.util.List<Parameter>getParameters()java.lang.StringgetResultName()TypegetResultType()TypegetReturnType()java.util.List<Parameter>getSourceParameters()java.util.List<Type>getThrownTypes()inthashCode()private java.lang.StringinitResultName(java.util.Collection<java.lang.String> existingVarNames)booleanisExistingInstanceMapping()booleanisStatic()java.lang.StringtoString()-
Methods inherited from class org.mapstruct.ap.internal.writer.FreeMarkerWritable
getTemplateName, getTemplateNameForClass, write
-
-
-
-
Field Detail
-
name
private final java.lang.String name
-
parameters
private final java.util.List<Parameter> parameters
-
sourceParameters
private final java.util.List<Parameter> sourceParameters
-
returnType
private final Type returnType
-
targetParameter
private final Parameter targetParameter
-
accessibility
private final Accessibility accessibility
-
thrownTypes
private final java.util.List<Type> thrownTypes
-
isStatic
private final boolean isStatic
-
resultName
private final java.lang.String resultName
-
beforeMappingReferencesWithMappingTarget
private final java.util.List<LifecycleCallbackMethodReference> beforeMappingReferencesWithMappingTarget
-
beforeMappingReferencesWithoutMappingTarget
private final java.util.List<LifecycleCallbackMethodReference> beforeMappingReferencesWithoutMappingTarget
-
afterMappingReferences
private final java.util.List<LifecycleCallbackMethodReference> afterMappingReferences
-
-
Constructor Detail
-
MappingMethod
protected MappingMethod(Method method, java.util.Collection<java.lang.String> existingVariableNames, java.util.List<LifecycleCallbackMethodReference> beforeMappingReferences, java.util.List<LifecycleCallbackMethodReference> afterMappingReferences)
constructor to be overloaded when local variable names are required prior to calling this constructor. (e.g. for property mappings). It is supposed to be initialized with at least the parameter names.- Parameters:
method- the method for which this mapping is applicableexistingVariableNames- set of already assigned variable namesbeforeMappingReferences- all life cycle methods to be called prior to carrying out mappingafterMappingReferences- all life cycle methods to be called after carrying out mapping
-
MappingMethod
protected MappingMethod(Method method, java.util.List<Parameter> parameters, java.util.Collection<java.lang.String> existingVariableNames, java.util.List<LifecycleCallbackMethodReference> beforeMappingReferences, java.util.List<LifecycleCallbackMethodReference> afterMappingReferences)
-
MappingMethod
protected MappingMethod(Method method)
-
MappingMethod
protected MappingMethod(Method method, java.util.List<LifecycleCallbackMethodReference> beforeMappingReferences, java.util.List<LifecycleCallbackMethodReference> afterMappingReferences)
-
-
Method Detail
-
initResultName
private java.lang.String initResultName(java.util.Collection<java.lang.String> existingVarNames)
-
getName
public java.lang.String getName()
-
getParameters
public java.util.List<Parameter> getParameters()
-
getSourceParameters
public java.util.List<Parameter> getSourceParameters()
-
getResultType
public Type getResultType()
-
getResultName
public java.lang.String getResultName()
-
getReturnType
public Type getReturnType()
-
getAccessibility
public Accessibility getAccessibility()
-
isExistingInstanceMapping
public boolean isExistingInstanceMapping()
-
isStatic
public boolean isStatic()
-
getImportTypes
public java.util.Set<Type> getImportTypes()
Description copied from class:ModelElementReturns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.- Specified by:
getImportTypesin classModelElement- Returns:
- A set with type referenced by this model element. Must not be
null.
-
getParameterNames
protected java.util.List<java.lang.String> getParameterNames()
-
getThrownTypes
public java.util.List<Type> getThrownTypes()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
filterMappingTarget
private java.util.List<LifecycleCallbackMethodReference> filterMappingTarget(java.util.List<LifecycleCallbackMethodReference> methods, boolean mustHaveMappingTargetParameter)
-
getAfterMappingReferences
public java.util.List<LifecycleCallbackMethodReference> getAfterMappingReferences()
-
getBeforeMappingReferencesWithMappingTarget
public java.util.List<LifecycleCallbackMethodReference> getBeforeMappingReferencesWithMappingTarget()
-
getBeforeMappingReferencesWithoutMappingTarget
public java.util.List<LifecycleCallbackMethodReference> getBeforeMappingReferencesWithoutMappingTarget()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-