Class MessageMethodBuilder.AptMessageMethod

java.lang.Object
org.jboss.logging.processor.apt.MessageMethodBuilder.AptMessageMethod
All Implemented Interfaces:
Comparable<MessageMethod>, AnnotatedConstruct, Element, ExecutableElement, Parameterizable, DelegatingElement, DelegatingExecutableElement, JavaDocComment, MessageMethod
Enclosing class:
MessageMethodBuilder

private static class MessageMethodBuilder.AptMessageMethod extends Object implements MessageMethod
An implementation for the MessageMethod interface.
  • Field Details

    • elements

      private final Elements elements
    • parameters

      private final Map<TypeMirror,Set<Parameter>> parameters
    • thrownTypes

      private final Set<ThrowableType> thrownTypes
    • method

      private final ExecutableElement method
    • returnType

      private ReturnType returnType
    • cause

      private Parameter cause
    • inheritsMessage

      private boolean inheritsMessage
    • isOverloaded

      private boolean isOverloaded
    • message

      private MessageMethod.Message message
    • messageMethodName

      private String messageMethodName
    • translationKey

      private String translationKey
    • formatParameterCount

      private int formatParameterCount
  • Constructor Details

    • AptMessageMethod

      AptMessageMethod(Elements elements, ExecutableElement method)
      Private constructor for the
      Parameters:
      elements - the elements utility.
      method - the method to describe.
  • Method Details

    • add

      void add(Parameter parameter)
    • name

      public String name()
      Description copied from interface: MessageMethod
      Returns the method name.
      Specified by:
      name in interface MessageMethod
      Returns:
      the method name.
    • parameters

      public Set<Parameter> parameters()
      Description copied from interface: MessageMethod
      Returns the parameters for the method.
      Specified by:
      parameters in interface MessageMethod
      Returns:
      the parameters for the method
    • parametersAnnotatedWith

      public Set<Parameter> parametersAnnotatedWith(Class<? extends Annotation> annotation)
      Description copied from interface: MessageMethod
      Returns an unmodifiable collection of the parameters specified by the parameter type or an empty set.
      Specified by:
      parametersAnnotatedWith in interface MessageMethod
      Parameters:
      annotation - the annotation to get the parameters for
      Returns:
      a collection of the parameters or an empty set.
    • returnType

      public ReturnType returnType()
      Description copied from interface: MessageMethod
      Returns the return type for the method.
      Specified by:
      returnType in interface MessageMethod
      Returns:
      the return type for the method.
    • thrownTypes

      public Set<ThrowableType> thrownTypes()
      Description copied from interface: MessageMethod
      Returns a collection of throwable types the method throws. If the method throws no exceptions an empty collection is returned.
      Specified by:
      thrownTypes in interface MessageMethod
      Returns:
      a collection of throwable types or an empty collection.
    • message

      public MessageMethod.Message message()
      Description copied from interface: MessageMethod
      The MessageMethod.Message to be used for the method.
      Specified by:
      message in interface MessageMethod
      Returns:
      the message.
    • inheritsMessage

      public boolean inheritsMessage()
      Description copied from interface: MessageMethod
      Indicates whether the message was inherited from another message or not. If true is returned the MessageMethod.Message was inherited from a different method, otherwise false.

      Note: false does not indicate the method has a Message annotation.

      Specified by:
      inheritsMessage in interface MessageMethod
      Returns:
      true if the message was inherited from a different method, otherwise false.
    • messageMethodName

      public String messageMethodName()
      Description copied from interface: MessageMethod
      Returns the name of the method used to retrieve the message.
      Specified by:
      messageMethodName in interface MessageMethod
      Returns:
      the name of the message method.
    • translationKey

      public String translationKey()
      Description copied from interface: MessageMethod
      Returns the name of the key used in the translation files for the message translation.
      Specified by:
      translationKey in interface MessageMethod
      Returns:
      the name of the key in the translation files.
    • hasCause

      public boolean hasCause()
      Description copied from interface: MessageMethod
      Returns true if there is a cause element, otherwise false.
      Specified by:
      hasCause in interface MessageMethod
      Returns:
      true if there is a cause element, otherwise false
    • isOverloaded

      public boolean isOverloaded()
      Description copied from interface: MessageMethod
      Returns true if the method is overloaded, otherwise false .
      Specified by:
      isOverloaded in interface MessageMethod
      Returns:
      true if the method is overloaded, otherwise false
    • cause

      public Parameter cause()
      Description copied from interface: MessageMethod
      Returns the cause element if MessageMethod.hasCause() returns true, otherwise null.
      Specified by:
      cause in interface MessageMethod
      Returns:
      the cause element, otherwise null.
    • loggerMethod

      public String loggerMethod()
      Description copied from interface: MessageMethod
      Returns the LogMessage annotation associated with this method only if MessageMethod.isLoggerMethod() returns true.
      Specified by:
      loggerMethod in interface MessageMethod
      Returns:
      the log message annotation
    • logLevel

      public String logLevel()
      Description copied from interface: MessageMethod
      Returns the log level parameter associated with the method only if MessageMethod.isLoggerMethod() returns true.
      Specified by:
      logLevel in interface MessageMethod
      Returns:
      the enum name of the log level
    • formatParameterCount

      public int formatParameterCount()
      Description copied from interface: MessageMethod
      Returns the number of parameters minus the cause parameter count for the method.
      Specified by:
      formatParameterCount in interface MessageMethod
      Returns:
      the number of parameters minus the cause parameter count for the method.
    • isLoggerMethod

      public boolean isLoggerMethod()
      Description copied from interface: MessageMethod
      Returns true if this is a logger method, otherwise false.
      Specified by:
      isLoggerMethod in interface MessageMethod
      Returns:
      true if this is a logger method, otherwise false.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Element
      Overrides:
      hashCode in class Object
    • getDelegate

      public ExecutableElement getDelegate()
      Description copied from interface: DelegatingElement
      The element to delegate the default methods to.
      Specified by:
      getDelegate in interface DelegatingElement
      Specified by:
      getDelegate in interface DelegatingExecutableElement
      Returns:
      the delegate
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Element
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(MessageMethod o)
      Specified by:
      compareTo in interface Comparable<MessageMethod>
    • getComment

      public String getComment()
      Description copied from interface: JavaDocComment
      The JavaDoc comments if available or null if there are no JavaDoc's present.
      Specified by:
      getComment in interface JavaDocComment
      Returns:
      the JavaDoc comments or null.