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.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
-
-
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 java.util.Set<Type>importTypesprivate SupportingConstructorFragmentsupportingConstructorFragmentprivate FieldsupportingFieldprivate java.lang.StringtemplateNameprivate java.util.Map<java.lang.String,java.lang.Object>templateParameter
-
Constructor Summary
Constructors Constructor Description SupportingMappingMethod(HelperMethod method)SupportingMappingMethod(BuiltInMethod method, java.util.Set<Field> existingFields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)TypefindType(java.lang.String name)Finds aTypeby a given name.java.util.Set<Type>getImportTypes()Returns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.SupportingConstructorFragmentgetSupportingConstructorFragment()FieldgetSupportingField()java.lang.StringgetTemplateName()Returns the name of the template to be used for a specific writable type.java.util.Map<java.lang.String,java.lang.Object>getTemplateParameter()inthashCode()-
Methods inherited from class org.mapstruct.ap.internal.model.MappingMethod
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
-
-
-
-
Field Detail
-
templateName
private final java.lang.String templateName
-
importTypes
private final java.util.Set<Type> importTypes
-
supportingField
private final Field supportingField
-
supportingConstructorFragment
private final SupportingConstructorFragment supportingConstructorFragment
-
templateParameter
private final java.util.Map<java.lang.String,java.lang.Object> templateParameter
-
-
Constructor Detail
-
SupportingMappingMethod
public SupportingMappingMethod(BuiltInMethod method, java.util.Set<Field> existingFields)
-
SupportingMappingMethod
public SupportingMappingMethod(HelperMethod method)
-
-
Method Detail
-
getTemplateName
public java.lang.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 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.- Overrides:
getImportTypesin classMappingMethod- Returns:
- A set with type referenced by this model element. Must not be
null.
-
findType
public Type findType(java.lang.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:
java.lang.IllegalArgumentException- In case noTypewas found for given name.
-
getSupportingField
public Field getSupportingField()
-
getSupportingConstructorFragment
public SupportingConstructorFragment getSupportingConstructorFragment()
-
getTemplateParameter
public java.util.Map<java.lang.String,java.lang.Object> getTemplateParameter()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classMappingMethod
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classMappingMethod
-
-