Class MappingOptions


  • public class MappingOptions
    extends DelegatingOptions
    Represents a property mapping as configured via @Mapping (no intermediate state).
    • 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
      • 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
    • 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)
      • 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()
      • 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()
      • 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
      • copyForForwardInheritance

        public MappingOptions copyForForwardInheritance​(SourceMethod templateMethod,
                                                        BeanMappingOptions beanMappingOptions)
        Creates a copy of this mapping
        Parameters:
        templateMethod - the template method for the inheritance
        beanMappingOptions - the bean mapping options
        Returns:
        the copy
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object