private static class MessageMethodBuilder.AptMessageMethod extends java.lang.Object implements MessageMethod
MessageMethod.Message
Modifier and Type | Field and Description |
---|---|
private Parameter |
cause |
private javax.lang.model.util.Elements |
elements |
private boolean |
inheritsMessage |
private boolean |
isOverloaded |
private MessageMethod.Message |
message |
private java.lang.String |
messageMethodName |
private javax.lang.model.element.ExecutableElement |
method |
private java.util.Map<Parameter.ParameterType,java.util.Set<Parameter>> |
parameters |
private ReturnType |
returnType |
private java.util.Set<ThrowableType> |
thrownTypes |
private java.lang.String |
translationKey |
Constructor and Description |
---|
AptMessageMethod(javax.lang.model.util.Elements elements,
javax.lang.model.element.ExecutableElement method)
Private constructor for the
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
add(Parameter parameter) |
Parameter |
cause()
|
int |
compareTo(MessageMethod o) |
boolean |
equals(java.lang.Object obj) |
int |
formatParameterCount()
Returns the number of parameters minus the cause parameter count for the method.
|
java.lang.String |
getComment()
The JavaDoc comments if available or
null if there are no JavaDoc's present. |
boolean |
hasCause()
Returns
true if there is a cause element, otherwise false . |
int |
hashCode() |
boolean |
inheritsMessage()
Indicates whether the message was inherited from another message or not.
|
boolean |
isLoggerMethod()
Returns
true if this is a logger method, otherwise false . |
boolean |
isOverloaded()
Returns
true if the method is overloaded, otherwise false
. |
java.lang.String |
loggerMethod()
Returns the LogMessage annotation associated with this method only if
MessageMethod.isLoggerMethod() returns
true . |
java.lang.String |
logLevel()
Returns the log level parameter associated with the method only if
MessageMethod.isLoggerMethod() returns
true . |
MessageMethod.Message |
message()
The
MessageMethod.Message to be used for the method. |
java.lang.String |
messageMethodName()
Returns the name of the method used to retrieve the message.
|
java.lang.String |
name()
Returns the method name.
|
java.util.Set<Parameter> |
parameters(Parameter.ParameterType parameterType)
Returns an unmodifiable collection of the parameters specified by the parameter type or an empty set.
|
java.util.Set<Parameter> |
parameters(Parameter.ParameterType parameterType,
Parameter.ParameterType... parameterTypes)
Returns an unmodifiable collection of the parameters specified by the parameter type or an empty set.
|
javax.lang.model.element.ExecutableElement |
reference()
The object used to extract information for the message logger or message bundle, if applicable.
|
ReturnType |
returnType()
Returns the return type for the method.
|
java.util.Set<ThrowableType> |
thrownTypes()
Returns a collection of throwable types the method throws.
|
java.lang.String |
toString() |
java.lang.String |
translationKey()
Returns the name of the key used in the translation files for the message translation.
|
private final javax.lang.model.util.Elements elements
private final java.util.Map<Parameter.ParameterType,java.util.Set<Parameter>> parameters
private final java.util.Set<ThrowableType> thrownTypes
private final javax.lang.model.element.ExecutableElement method
private ReturnType returnType
private Parameter cause
private boolean inheritsMessage
private boolean isOverloaded
private MessageMethod.Message message
private java.lang.String messageMethodName
private java.lang.String translationKey
AptMessageMethod(javax.lang.model.util.Elements elements, javax.lang.model.element.ExecutableElement method)
elements
- the elements utility.method
- the method to describe.void add(Parameter parameter)
public java.lang.String name()
MessageMethod
name
in interface MessageMethod
name
in interface MessageObject
public java.util.Set<Parameter> parameters(Parameter.ParameterType parameterType)
MessageMethod
parameters
in interface MessageMethod
parameterType
- the parameter type to look-up the parameters for.public java.util.Set<Parameter> parameters(Parameter.ParameterType parameterType, Parameter.ParameterType... parameterTypes)
MessageMethod
parameters
in interface MessageMethod
parameterType
- the parameter type to look-up the parameters for.parameterTypes
- an array of types to look-up parameters for.public ReturnType returnType()
MessageMethod
returnType
in interface MessageMethod
public java.util.Set<ThrowableType> thrownTypes()
MessageMethod
thrownTypes
in interface MessageMethod
public MessageMethod.Message message()
MessageMethod
MessageMethod.Message
to be used for the method.message
in interface MessageMethod
public boolean inheritsMessage()
MessageMethod
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.inheritsMessage
in interface MessageMethod
true
if the message was inherited from a different method, otherwise false
.public java.lang.String messageMethodName()
MessageMethod
messageMethodName
in interface MessageMethod
public java.lang.String translationKey()
MessageMethod
translationKey
in interface MessageMethod
public boolean hasCause()
MessageMethod
true
if there is a cause element, otherwise false
.hasCause
in interface MessageMethod
true
if there is a cause element, otherwise false
public boolean isOverloaded()
MessageMethod
true
if the method is overloaded, otherwise false
.isOverloaded
in interface MessageMethod
true
if the method is overloaded, otherwise false
public Parameter cause()
MessageMethod
cause
in interface MessageMethod
null
.public java.lang.String loggerMethod()
MessageMethod
MessageMethod.isLoggerMethod()
returns
true
.loggerMethod
in interface MessageMethod
public java.lang.String logLevel()
MessageMethod
MessageMethod.isLoggerMethod()
returns
true
.logLevel
in interface MessageMethod
public int formatParameterCount()
MessageMethod
formatParameterCount
in interface MessageMethod
public boolean isLoggerMethod()
MessageMethod
true
if this is a logger method, otherwise false
.isLoggerMethod
in interface MessageMethod
true
if this is a logger method, otherwise false
.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public javax.lang.model.element.ExecutableElement reference()
MessageObject
ExecutableElement
might be returned.reference
in interface MessageMethod
reference
in interface MessageObject
public int compareTo(MessageMethod o)
compareTo
in interface java.lang.Comparable<MessageMethod>
public java.lang.String getComment()
JavaDocComment
null
if there are no JavaDoc's present.getComment
in interface JavaDocComment
null
.