Class MapperAnnotatedFormattingMessenger

  • All Implemented Interfaces:
    FormattingMessager

    public class MapperAnnotatedFormattingMessenger
    extends java.lang.Object
    implements FormattingMessager
    Handles redirection of errors/warnings so that they're shown on the mapper instead of hidden on a superclass.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String constructMethod​(javax.lang.model.element.Element e)
      ExecutableElement.toString() has different values depending on the compiler.
      private java.lang.Object[] determineDelegationArguments​(javax.lang.model.element.Element e, Message msg, java.lang.Object[] args)  
      private javax.lang.model.element.Element determineDelegationElement​(javax.lang.model.element.Element e)  
      private Message determineDelegationMessage​(javax.lang.model.element.Element e, Message msg)  
      boolean isErroneous()  
      private boolean methodInMapperClass​(javax.lang.model.element.Element e)  
      void note​(int level, Message log, java.lang.Object... args)
      Just log as plain note
      private java.lang.String parameterToString​(javax.lang.model.element.VariableElement element)  
      void printMessage​(javax.lang.model.element.Element e, javax.lang.model.element.AnnotationMirror a, javax.lang.model.element.AnnotationValue v, Message msg, java.lang.Object... args)
      Prints a message of the specified kind at the location of the annotation value inside the annotation positionHint of the annotated element.
      void printMessage​(javax.lang.model.element.Element e, javax.lang.model.element.AnnotationMirror a, Message msg, java.lang.Object... args)
      Prints a message of the specified kind at the location of the annotation positionHint of the annotated element.
      void printMessage​(javax.lang.model.element.Element e, Message msg, java.lang.Object... args)
      Prints a message of the specified kind at the location of the element.
      void printMessage​(Message msg, java.lang.Object... args)
      Prints a message of the specified kind.
      private java.lang.String typeMirrorToString​(javax.lang.model.type.TypeMirror type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mapperTypeElement

        private javax.lang.model.element.TypeElement mapperTypeElement
    • Constructor Detail

      • MapperAnnotatedFormattingMessenger

        public MapperAnnotatedFormattingMessenger​(FormattingMessager delegateMessager,
                                                  javax.lang.model.element.TypeElement mapperTypeElement,
                                                  TypeUtils typeUtils)
    • Method Detail

      • printMessage

        public void printMessage​(Message msg,
                                 java.lang.Object... args)
        Description copied from interface: FormattingMessager
        Prints a message of the specified kind.
        Specified by:
        printMessage in interface FormattingMessager
        Parameters:
        msg - the message
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored
      • printMessage

        public void printMessage​(javax.lang.model.element.Element e,
                                 Message msg,
                                 java.lang.Object... args)
        Description copied from interface: FormattingMessager
        Prints a message of the specified kind at the location of the element.
        Specified by:
        printMessage in interface FormattingMessager
        Parameters:
        e - the element to use as a position hint
        msg - the message
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored
      • printMessage

        public void printMessage​(javax.lang.model.element.Element e,
                                 javax.lang.model.element.AnnotationMirror a,
                                 Message msg,
                                 java.lang.Object... args)
        Description copied from interface: FormattingMessager
        Prints a message of the specified kind at the location of the annotation positionHint of the annotated element.
        Specified by:
        printMessage in interface FormattingMessager
        Parameters:
        e - the annotated element
        a - the annotation to use as a position hint (can be null)
        msg - the message
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored
      • printMessage

        public void printMessage​(javax.lang.model.element.Element e,
                                 javax.lang.model.element.AnnotationMirror a,
                                 javax.lang.model.element.AnnotationValue v,
                                 Message msg,
                                 java.lang.Object... args)
        Description copied from interface: FormattingMessager
        Prints a message of the specified kind at the location of the annotation value inside the annotation positionHint of the annotated element.
        Specified by:
        printMessage in interface FormattingMessager
        Parameters:
        e - the annotated element
        a - the annotation containing the annotation value
        v - the annotation value to use as a position hint
        msg - the message
        args - Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored
      • note

        public void note​(int level,
                         Message log,
                         java.lang.Object... args)
        Description copied from interface: FormattingMessager
        Just log as plain note
        Specified by:
        note in interface FormattingMessager
        Parameters:
        level - nesting level
        log - the log message
        args - the arguments
      • determineDelegationArguments

        private java.lang.Object[] determineDelegationArguments​(javax.lang.model.element.Element e,
                                                                Message msg,
                                                                java.lang.Object[] args)
      • constructMethod

        private java.lang.String constructMethod​(javax.lang.model.element.Element e)
        ExecutableElement.toString() has different values depending on the compiler. Constructing the method itself manually will ensure that the message is always traceable to it's source.
      • parameterToString

        private java.lang.String parameterToString​(javax.lang.model.element.VariableElement element)
      • typeMirrorToString

        private java.lang.String typeMirrorToString​(javax.lang.model.type.TypeMirror type)
      • determineDelegationMessage

        private Message determineDelegationMessage​(javax.lang.model.element.Element e,
                                                   Message msg)
      • determineDelegationElement

        private javax.lang.model.element.Element determineDelegationElement​(javax.lang.model.element.Element e)
      • methodInMapperClass

        private boolean methodInMapperClass​(javax.lang.model.element.Element e)