Class MappingOptions
- java.lang.Object
-
- org.mapstruct.ap.internal.model.source.DelegatingOptions
-
- org.mapstruct.ap.internal.model.source.MappingOptions
-
public class MappingOptions extends DelegatingOptions
Represents a property mapping as configured via@Mapping(no intermediate state).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMappingOptions.InheritContext
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringconditionJavaExpressionprivate java.lang.Stringconstantprivate java.lang.StringdefaultJavaExpressionprivate java.lang.StringdefaultValueprivate java.util.Set<java.lang.String>dependsOnprivate javax.lang.model.element.Elementelementprivate FormattingParametersformattingParametersprivate MappingOptions.InheritContextinheritContextprivate booleanisIgnoredprivate static java.util.regex.PatternJAVA_EXPRESSIONprivate java.lang.StringjavaExpressionprivate MappingGemmappingprivate SelectionParametersselectionParametersprivate javax.lang.model.element.AnnotationValuesourceAnnotationValueprivate java.lang.StringsourceNameprivate javax.lang.model.element.AnnotationValuetargetAnnotationValueprivate java.lang.StringtargetName
-
Constructor Summary
Constructors Modifier Constructor Description privateMappingOptions(java.lang.String targetName, javax.lang.model.element.Element element, javax.lang.model.element.AnnotationValue targetAnnotationValue, java.lang.String sourceName, javax.lang.model.element.AnnotationValue sourceAnnotationValue, java.lang.String constant, java.lang.String javaExpression, java.lang.String defaultJavaExpression, java.lang.String conditionJavaExpression, java.lang.String defaultValue, boolean isIgnored, FormattingParameters formattingParameters, SelectionParameters selectionParameters, java.util.Set<java.lang.String> dependsOn, MappingGem mapping, MappingOptions.InheritContext inheritContext, DelegatingOptions next)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddInstance(MappingGem mapping, javax.lang.model.element.ExecutableElement method, BeanMappingOptions beanMappingOptions, FormattingMessager messager, TypeUtils typeUtils, java.util.Set<MappingOptions> mappings)static voidaddInstances(MappingsGem gem, javax.lang.model.element.ExecutableElement method, BeanMappingOptions beanMappingOptions, FormattingMessager messager, TypeUtils typeUtils, java.util.Set<MappingOptions> mappings)booleancanInverse()mapping can only be inversed if the source was not a constant nor an expression nor a nested property and the mapping is not a 'target-source-ignore' mappingMappingOptionscopyForForwardInheritance(SourceMethod templateMethod, BeanMappingOptions beanMappingOptions)Creates a copy of this mappingMappingOptionscopyForInverseInheritance(SourceMethod templateMethod, BeanMappingOptions beanMappingOptions)booleanequals(java.lang.Object o)static MappingOptionsforIgnore(java.lang.String targetName)private static java.lang.StringgetConditionExpression(MappingGem mapping, javax.lang.model.element.ExecutableElement element, FormattingMessager messager)java.lang.StringgetConditionJavaExpression()java.lang.StringgetConstant()private static java.lang.StringgetDefaultExpression(MappingGem mapping, javax.lang.model.element.ExecutableElement element, FormattingMessager messager)java.lang.StringgetDefaultJavaExpression()java.lang.StringgetDefaultValue()java.util.Set<java.lang.String>getDependsOn()javax.lang.model.element.AnnotationValuegetDependsOnAnnotationValue()javax.lang.model.element.ElementgetElement()private static java.lang.StringgetExpression(MappingGem mapping, javax.lang.model.element.ExecutableElement element, FormattingMessager messager)FormattingParametersgetFormattingParameters()MappingOptions.InheritContextgetInheritContext()java.lang.StringgetJavaExpression()MappingControlgetMappingControl(ElementUtils elementUtils)static java.util.Set<java.lang.String>getMappingTargetNamesBy(java.util.function.Predicate<MappingOptions> predicate, java.util.Set<MappingOptions> mappings)javax.lang.model.element.AnnotationMirrorgetMirror()NullValueCheckStrategyGemgetNullValueCheckStrategy()NullValuePropertyMappingStrategyGemgetNullValuePropertyMappingStrategy()SelectionParametersgetSelectionParameters()javax.lang.model.element.AnnotationValuegetSourceAnnotationValue()java.lang.StringgetSourceName()Returns the complete source name of this mapping, either a qualified (e.g.javax.lang.model.element.AnnotationValuegetTargetAnnotationValue()java.lang.StringgetTargetName()booleanhasAnnotation()inthashCode()private static booleanisConsistent(MappingGem gem, javax.lang.model.element.ExecutableElement method, FormattingMessager messager)booleanisIgnored()java.lang.StringtoString()-
Methods inherited from class org.mapstruct.ap.internal.model.source.DelegatingOptions
componentModel, getBuilder, getCollectionMappingStrategy, getInjectionStrategy, getMappingInheritanceStrategy, getNullValueIterableMappingStrategy, getNullValueMapMappingStrategy, getNullValueMappingStrategy, getSubclassExhaustiveStrategy, getUnexpectedValueMappingException, implementationName, implementationPackage, imports, isDisableSubMappingMethodsGeneration, next, suppressTimestampInGenerated, toDeclaredTypes, typeConversionPolicy, unmappedSourcePolicy, unmappedTargetPolicy, uses
-
-
-
-
Field Detail
-
JAVA_EXPRESSION
private static final java.util.regex.Pattern JAVA_EXPRESSION
-
sourceName
private final java.lang.String sourceName
-
constant
private final java.lang.String constant
-
javaExpression
private final java.lang.String javaExpression
-
defaultJavaExpression
private final java.lang.String defaultJavaExpression
-
conditionJavaExpression
private final java.lang.String conditionJavaExpression
-
targetName
private final java.lang.String targetName
-
defaultValue
private final java.lang.String defaultValue
-
formattingParameters
private final FormattingParameters formattingParameters
-
selectionParameters
private final SelectionParameters selectionParameters
-
isIgnored
private final boolean isIgnored
-
dependsOn
private final java.util.Set<java.lang.String> dependsOn
-
element
private final javax.lang.model.element.Element element
-
sourceAnnotationValue
private final javax.lang.model.element.AnnotationValue sourceAnnotationValue
-
targetAnnotationValue
private final javax.lang.model.element.AnnotationValue targetAnnotationValue
-
mapping
private final MappingGem mapping
-
inheritContext
private final MappingOptions.InheritContext inheritContext
-
-
Constructor Detail
-
MappingOptions
private MappingOptions(java.lang.String targetName, javax.lang.model.element.Element element, javax.lang.model.element.AnnotationValue targetAnnotationValue, java.lang.String sourceName, javax.lang.model.element.AnnotationValue sourceAnnotationValue, java.lang.String constant, java.lang.String javaExpression, java.lang.String defaultJavaExpression, java.lang.String conditionJavaExpression, java.lang.String defaultValue, boolean isIgnored, FormattingParameters formattingParameters, SelectionParameters selectionParameters, java.util.Set<java.lang.String> dependsOn, MappingGem mapping, MappingOptions.InheritContext inheritContext, DelegatingOptions next)
-
-
Method Detail
-
getMappingTargetNamesBy
public static java.util.Set<java.lang.String> getMappingTargetNamesBy(java.util.function.Predicate<MappingOptions> predicate, java.util.Set<MappingOptions> mappings)
-
addInstances
public static void addInstances(MappingsGem gem, javax.lang.model.element.ExecutableElement method, BeanMappingOptions beanMappingOptions, FormattingMessager messager, TypeUtils typeUtils, java.util.Set<MappingOptions> mappings)
-
addInstance
public static void addInstance(MappingGem mapping, javax.lang.model.element.ExecutableElement method, BeanMappingOptions beanMappingOptions, FormattingMessager messager, TypeUtils typeUtils, java.util.Set<MappingOptions> mappings)
-
forIgnore
public static MappingOptions forIgnore(java.lang.String targetName)
-
isConsistent
private static boolean isConsistent(MappingGem gem, javax.lang.model.element.ExecutableElement method, FormattingMessager messager)
-
getExpression
private static java.lang.String getExpression(MappingGem mapping, javax.lang.model.element.ExecutableElement element, FormattingMessager messager)
-
getDefaultExpression
private static java.lang.String getDefaultExpression(MappingGem mapping, javax.lang.model.element.ExecutableElement element, FormattingMessager messager)
-
getConditionExpression
private static java.lang.String getConditionExpression(MappingGem mapping, javax.lang.model.element.ExecutableElement element, FormattingMessager messager)
-
getTargetName
public java.lang.String getTargetName()
-
getTargetAnnotationValue
public javax.lang.model.element.AnnotationValue getTargetAnnotationValue()
-
getSourceName
public java.lang.String getSourceName()
Returns the complete source name of this mapping, either a qualified (e.g.parameter1.foo) or unqualified (e.g.foo) property reference.- Returns:
- The complete source name of this mapping.
-
getSourceAnnotationValue
public javax.lang.model.element.AnnotationValue getSourceAnnotationValue()
-
getConstant
public java.lang.String getConstant()
-
getJavaExpression
public java.lang.String getJavaExpression()
-
getDefaultJavaExpression
public java.lang.String getDefaultJavaExpression()
-
getConditionJavaExpression
public java.lang.String getConditionJavaExpression()
-
getDefaultValue
public java.lang.String getDefaultValue()
-
getFormattingParameters
public FormattingParameters getFormattingParameters()
-
getSelectionParameters
public SelectionParameters getSelectionParameters()
-
isIgnored
public boolean isIgnored()
-
getMirror
public javax.lang.model.element.AnnotationMirror getMirror()
-
getElement
public javax.lang.model.element.Element getElement()
-
getDependsOnAnnotationValue
public javax.lang.model.element.AnnotationValue getDependsOnAnnotationValue()
-
getDependsOn
public java.util.Set<java.lang.String> getDependsOn()
-
getInheritContext
public MappingOptions.InheritContext getInheritContext()
-
getNullValueCheckStrategy
public NullValueCheckStrategyGem getNullValueCheckStrategy()
- Overrides:
getNullValueCheckStrategyin classDelegatingOptions
-
getNullValuePropertyMappingStrategy
public NullValuePropertyMappingStrategyGem getNullValuePropertyMappingStrategy()
- Overrides:
getNullValuePropertyMappingStrategyin classDelegatingOptions
-
getMappingControl
public MappingControl getMappingControl(ElementUtils elementUtils)
- Overrides:
getMappingControlin classDelegatingOptions
-
canInverse
public boolean canInverse()
mapping can only be inversed if the source was not a constant nor an expression nor a nested property and the mapping is not a 'target-source-ignore' mapping- Returns:
- true when the above applies
-
copyForInverseInheritance
public MappingOptions copyForInverseInheritance(SourceMethod templateMethod, BeanMappingOptions beanMappingOptions)
-
copyForForwardInheritance
public MappingOptions copyForForwardInheritance(SourceMethod templateMethod, BeanMappingOptions beanMappingOptions)
Creates a copy of this mapping- Parameters:
templateMethod- the template method for the inheritancebeanMappingOptions- the bean mapping options- Returns:
- the copy
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hasAnnotation
public boolean hasAnnotation()
- Specified by:
hasAnnotationin classDelegatingOptions
-
-