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.FinalFieldandNewDatatypeFactoryConstructorFragment- 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 booleanequals(Object obj)TypefindType(String name)Finds aTypeby a given name.Set<Type>getImportTypes()Returns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.SupportingConstructorFragmentgetSupportingConstructorFragment()FieldgetSupportingField()StringgetTemplateName()Returns the name of the template to be used for a specific writable type.Map<String,Object>getTemplateParameter()inthashCode()-
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:FreeMarkerWritableReturns 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:
getTemplateNamein classFreeMarkerWritable- Returns:
- the name of the template. Must not be
null.
-
getImportTypes
public 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.- Overrides:
getImportTypesin classMappingMethod- Returns:
- A set with type referenced by this model element. Must not be
null.
-
findType
public Type findType(String name)
Finds aTypeby a given name. Thenamewill 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 noTypewas found for given name.
-
getSupportingField
public Field getSupportingField()
-
getSupportingConstructorFragment
public SupportingConstructorFragment getSupportingConstructorFragment()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classMappingMethod
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classMappingMethod
-
-