Package org.jboss.logging.processor.apt
Class MessageMethodBuilder.AptMessageMethod
- java.lang.Object
-
- org.jboss.logging.processor.apt.MessageMethodBuilder.AptMessageMethod
-
- All Implemented Interfaces:
java.lang.Comparable<MessageMethod>,javax.lang.model.AnnotatedConstruct,javax.lang.model.element.Element,javax.lang.model.element.ExecutableElement,javax.lang.model.element.Parameterizable,DelegatingElement,DelegatingExecutableElement,JavaDocComment,MessageMethod
- Enclosing class:
- MessageMethodBuilder
private static class MessageMethodBuilder.AptMessageMethod extends java.lang.Object implements MessageMethod
An implementation for the MessageMethod interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.logging.processor.model.MessageMethod
MessageMethod.Message
-
-
Field Summary
Fields Modifier and Type Field Description private Parametercauseprivate javax.lang.model.util.Elementselementsprivate intformatParameterCountprivate booleaninheritsMessageprivate booleanisOverloadedprivate MessageMethod.Messagemessageprivate java.lang.StringmessageMethodNameprivate javax.lang.model.element.ExecutableElementmethodprivate java.util.Map<javax.lang.model.type.TypeMirror,java.util.Set<Parameter>>parametersprivate ReturnTypereturnTypeprivate java.util.Set<ThrowableType>thrownTypesprivate java.lang.StringtranslationKey
-
Constructor Summary
Constructors Constructor Description AptMessageMethod(javax.lang.model.util.Elements elements, javax.lang.model.element.ExecutableElement method)Private constructor for the
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(Parameter parameter)Parametercause()intcompareTo(MessageMethod o)booleanequals(java.lang.Object obj)intformatParameterCount()Returns the number of parameters minus the cause parameter count for the method.java.lang.StringgetComment()The JavaDoc comments if available ornullif there are no JavaDoc's present.javax.lang.model.element.ExecutableElementgetDelegate()The element to delegate the default methods to.booleanhasCause()Returnstrueif there is a cause element, otherwisefalse.inthashCode()booleaninheritsMessage()Indicates whether the message was inherited from another message or not.booleanisLoggerMethod()Returnstrueif this is a logger method, otherwisefalse.booleanisOverloaded()Returnstrueif the method is overloaded, otherwisefalse.java.lang.StringloggerMethod()Returns the LogMessage annotation associated with this method only ifMessageMethod.isLoggerMethod()returnstrue.java.lang.StringlogLevel()Returns the log level parameter associated with the method only ifMessageMethod.isLoggerMethod()returnstrue.MessageMethod.Messagemessage()TheMessageMethod.Messageto be used for the method.java.lang.StringmessageMethodName()Returns the name of the method used to retrieve the message.java.lang.Stringname()Returns the method name.java.util.Set<Parameter>parameters()Returns the parameters for the method.java.util.Set<Parameter>parametersAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)Returns an unmodifiable collection of the parameters specified by the parameter type or an empty set.ReturnTypereturnType()Returns the return type for the method.java.util.Set<ThrowableType>thrownTypes()Returns a collection of throwable types the method throws.java.lang.StringtoString()java.lang.StringtranslationKey()Returns the name of the key used in the translation files for the message translation.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jboss.logging.processor.model.DelegatingElement
accept, getAnnotation, getAnnotationMirrors, getAnnotationsByType, getEnclosedElements, getEnclosingElement, getKind, getModifiers, isAnnotatedWith
-
Methods inherited from interface org.jboss.logging.processor.model.DelegatingExecutableElement
asType, getDefaultValue, getParameters, getReceiverType, getReturnType, getSimpleName, getThrownTypes, getTypeParameters, isDefault, isVarArgs
-
-
-
-
Field Detail
-
elements
private final javax.lang.model.util.Elements elements
-
parameters
private final java.util.Map<javax.lang.model.type.TypeMirror,java.util.Set<Parameter>> parameters
-
thrownTypes
private final java.util.Set<ThrowableType> thrownTypes
-
method
private final javax.lang.model.element.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 java.lang.String messageMethodName
-
translationKey
private java.lang.String translationKey
-
formatParameterCount
private int formatParameterCount
-
-
Method Detail
-
add
void add(Parameter parameter)
-
name
public java.lang.String name()
Description copied from interface:MessageMethodReturns the method name.- Specified by:
namein interfaceMessageMethod- Returns:
- the method name.
-
parameters
public java.util.Set<Parameter> parameters()
Description copied from interface:MessageMethodReturns the parameters for the method.- Specified by:
parametersin interfaceMessageMethod- Returns:
- the parameters for the method
-
parametersAnnotatedWith
public java.util.Set<Parameter> parametersAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Description copied from interface:MessageMethodReturns an unmodifiable collection of the parameters specified by the parameter type or an empty set.- Specified by:
parametersAnnotatedWithin interfaceMessageMethod- 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:MessageMethodReturns the return type for the method.- Specified by:
returnTypein interfaceMessageMethod- Returns:
- the return type for the method.
-
thrownTypes
public java.util.Set<ThrowableType> thrownTypes()
Description copied from interface:MessageMethodReturns a collection of throwable types the method throws. If the method throws no exceptions an empty collection is returned.- Specified by:
thrownTypesin interfaceMessageMethod- Returns:
- a collection of throwable types or an empty collection.
-
message
public MessageMethod.Message message()
Description copied from interface:MessageMethodTheMessageMethod.Messageto be used for the method.- Specified by:
messagein interfaceMessageMethod- Returns:
- the message.
-
inheritsMessage
public boolean inheritsMessage()
Description copied from interface:MessageMethodIndicates whether the message was inherited from another message or not. Iftrueis returned theMessageMethod.Messagewas inherited from a different method, otherwisefalse. Note:falsedoes not indicate the method has aMessageannotation.- Specified by:
inheritsMessagein interfaceMessageMethod- Returns:
trueif the message was inherited from a different method, otherwisefalse.
-
messageMethodName
public java.lang.String messageMethodName()
Description copied from interface:MessageMethodReturns the name of the method used to retrieve the message.- Specified by:
messageMethodNamein interfaceMessageMethod- Returns:
- the name of the message method.
-
translationKey
public java.lang.String translationKey()
Description copied from interface:MessageMethodReturns the name of the key used in the translation files for the message translation.- Specified by:
translationKeyin interfaceMessageMethod- Returns:
- the name of the key in the translation files.
-
hasCause
public boolean hasCause()
Description copied from interface:MessageMethodReturnstrueif there is a cause element, otherwisefalse.- Specified by:
hasCausein interfaceMessageMethod- Returns:
trueif there is a cause element, otherwisefalse
-
isOverloaded
public boolean isOverloaded()
Description copied from interface:MessageMethodReturnstrueif the method is overloaded, otherwisefalse.- Specified by:
isOverloadedin interfaceMessageMethod- Returns:
trueif the method is overloaded, otherwisefalse
-
cause
public Parameter cause()
Description copied from interface:MessageMethod- Specified by:
causein interfaceMessageMethod- Returns:
- the cause element, otherwise
null.
-
loggerMethod
public java.lang.String loggerMethod()
Description copied from interface:MessageMethodReturns the LogMessage annotation associated with this method only ifMessageMethod.isLoggerMethod()returnstrue.- Specified by:
loggerMethodin interfaceMessageMethod- Returns:
- the log message annotation
-
logLevel
public java.lang.String logLevel()
Description copied from interface:MessageMethodReturns the log level parameter associated with the method only ifMessageMethod.isLoggerMethod()returnstrue.- Specified by:
logLevelin interfaceMessageMethod- Returns:
- the enum name of the log level
-
formatParameterCount
public int formatParameterCount()
Description copied from interface:MessageMethodReturns the number of parameters minus the cause parameter count for the method.- Specified by:
formatParameterCountin interfaceMessageMethod- Returns:
- the number of parameters minus the cause parameter count for the method.
-
isLoggerMethod
public boolean isLoggerMethod()
Description copied from interface:MessageMethodReturnstrueif this is a logger method, otherwisefalse.- Specified by:
isLoggerMethodin interfaceMessageMethod- Returns:
trueif this is a logger method, otherwisefalse.
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejavax.lang.model.element.Element- Overrides:
hashCodein classjava.lang.Object
-
getDelegate
public javax.lang.model.element.ExecutableElement getDelegate()
Description copied from interface:DelegatingElementThe element to delegate the default methods to.- Specified by:
getDelegatein interfaceDelegatingElement- Specified by:
getDelegatein interfaceDelegatingExecutableElement- Returns:
- the delegate
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejavax.lang.model.element.Element- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(MessageMethod o)
- Specified by:
compareToin interfacejava.lang.Comparable<MessageMethod>
-
getComment
public java.lang.String getComment()
Description copied from interface:JavaDocCommentThe JavaDoc comments if available ornullif there are no JavaDoc's present.- Specified by:
getCommentin interfaceJavaDocComment- Returns:
- the JavaDoc comments or
null.
-
-