Package org.mapstruct.ap.internal.model
Class SupportingMappingMethod
- java.lang.Object
-
- org.mapstruct.ap.internal.writer.FreeMarkerWritable
-
- org.mapstruct.ap.internal.model.common.ModelElement
-
- org.mapstruct.ap.internal.model.GeneratedTypeMethod
-
- org.mapstruct.ap.internal.model.MappingMethod
-
- org.mapstruct.ap.internal.model.SupportingMappingMethod
-
- All Implemented Interfaces:
Writable
public class SupportingMappingMethod extends MappingMethod
A mapping method which is not based on an actual method declared in the original mapper interface but is added as private method to map a certain source/target type combination. Based on aBuiltInMethod
. Specific templates all point to this class, for instance:XmlGregorianCalendarToCalendar
, but also used fields and constructor elements, e.g.FinalField
andNewDatatypeFactoryConstructorFragment
- Author:
- Gunnar Morling
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.writer.Writable
Writable.Context
-
-
Constructor Summary
Constructors Constructor Description SupportingMappingMethod(HelperMethod method)
SupportingMappingMethod(BuiltInMethod method, Set<Field> existingFields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Type
findType(String name)
Finds aType
by a given name.Set<Type>
getImportTypes()
Returns a set containing thoseType
s referenced by this model element for which an import statement needs to be declared.SupportingConstructorFragment
getSupportingConstructorFragment()
Field
getSupportingField()
String
getTemplateName()
Returns the name of the template to be used for a specific writable type.Map<String,Object>
getTemplateParameter()
int
hashCode()
-
Methods inherited from class org.mapstruct.ap.internal.model.MappingMethod
filterMappingTarget, getAccessibility, getAfterMappingReferences, getBeforeMappingReferencesWithMappingTarget, getBeforeMappingReferencesWithoutMappingTarget, getName, getParameterNames, getParameters, getResultName, getResultType, getReturnType, getSourceParameters, getThrownTypes, isExistingInstanceMapping, isStatic, toString
-
Methods inherited from class org.mapstruct.ap.internal.writer.FreeMarkerWritable
getTemplateNameForClass, write
-
-
-
-
Constructor Detail
-
SupportingMappingMethod
public SupportingMappingMethod(BuiltInMethod method, Set<Field> existingFields)
-
SupportingMappingMethod
public SupportingMappingMethod(HelperMethod method)
-
-
Method Detail
-
getTemplateName
public String getTemplateName()
Description copied from class:FreeMarkerWritable
Returns the name of the template to be used for a specific writable type. By default,FreeMarkerWritable.getTemplateNameForClass(Class)
is called withgetClass()
, but this can be customized by overriding this method if required.- Overrides:
getTemplateName
in classFreeMarkerWritable
- Returns:
- the name of the template. Must not be
null
.
-
getImportTypes
public Set<Type> getImportTypes()
Description copied from class:ModelElement
Returns a set containing thoseType
s referenced by this model element for which an import statement needs to be declared.- Overrides:
getImportTypes
in classMappingMethod
- Returns:
- A set with type referenced by this model element. Must not be
null
.
-
findType
public Type findType(String name)
Finds aType
by a given name. Thename
will be compared to the fully-qualified and also simple names of theimportTypes
.- Parameters:
name
- Fully-qualified or simple name of the type.- Returns:
- Found type, never
null
. - Throws:
IllegalArgumentException
- In case noType
was found for given name.
-
getSupportingField
public Field getSupportingField()
-
getSupportingConstructorFragment
public SupportingConstructorFragment getSupportingConstructorFragment()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classMappingMethod
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classMappingMethod
-
-