public class AnnotationsImpl extends Object implements Annotations
local annotations
and deprecated annotations
that were part of the jboss-logging
project.Annotations.FormatType, Annotations.Void
Constructor and Description |
---|
AnnotationsImpl() |
Modifier and Type | Method and Description |
---|---|
String |
getFormatWithAnnotationName(VariableElement param)
Returns the name of the
@FormatWith class. |
String |
getMessageLoggerAnnotationName(TypeElement element)
Returns the name of the
@MessageLogger class. |
Set<String> |
getSupportedAnnotations()
Returns a set of the supported annotations.
|
boolean |
hasCauseAnnotation(VariableElement param)
Checks to see if the parameter has a cause annotation.
|
boolean |
hasFieldAnnotation(VariableElement param)
Checks to see if the parameter has a field annotation.
|
boolean |
hasLoggingClassAnnotation(VariableElement param)
Checks to see if the parameter has a logging class annotation.
|
boolean |
hasMessageAnnotation(ExecutableElement method)
Checks to see if the method is annotated with the message annotation.
|
boolean |
hasMessageId(ExecutableElement method)
Checks to see if the method has a message id.
|
boolean |
hasParamAnnotation(VariableElement param)
Checks to see if the parameter has a parameter annotation.
|
boolean |
hasPropertyAnnotation(VariableElement param)
Checks to see if the parameter has a property annotation.
|
int |
idLength(TypeElement intf)
The length the id should be padded.
|
boolean |
inheritsMessageId(ExecutableElement method)
Checks to see if the method should inherit the message id from a different method if applicable.
|
boolean |
isLoggerMethod(ExecutableElement method)
Checks to see if the method is a logger method.
|
boolean |
isMessageBundle(TypeElement element)
Checks the
element to see it's a message bundle. |
boolean |
isMessageLogger(TypeElement element)
Checks the
element to see it's a message logger. |
boolean |
isSupportedInterfaceAnnotation(TypeElement annotation)
Checks that the annotation is a supported interface annotation.
|
String |
loggerMethod(Annotations.FormatType formatType)
Returns the logger method name to use or an empty string if the method is not a logger method.
|
String |
logLevel(ExecutableElement method)
Returns the log level enum.
|
Annotations.FormatType |
messageFormat(ExecutableElement method)
Returns the method format type.
|
int |
messageId(ExecutableElement method)
Returns the message id.
|
String |
messageValue(ExecutableElement method)
Returns the message value for the method.
|
String |
projectCode(TypeElement intf)
The project code from the interface.
|
String |
targetName(VariableElement param)
Returns the target field or method name for the annotated parameter.
|
public Set<String> getSupportedAnnotations()
Annotations
getSupportedAnnotations
in interface Annotations
public boolean isSupportedInterfaceAnnotation(TypeElement annotation)
Annotations
false
is returned. The annotations should just be skipped.isSupportedInterfaceAnnotation
in interface Annotations
annotation
- the annotation to checktrue
if this is a supported interface annotation, false
if the annotation should be
skippedpublic Annotations.FormatType messageFormat(ExecutableElement method)
Annotations
messageFormat
in interface Annotations
method
- the method with the Message annotation.null
if the format type
was not found.public String projectCode(TypeElement intf)
Annotations
projectCode
in interface Annotations
intf
- the interface to find the project code on.null
if one was not found.public int idLength(TypeElement intf)
Annotations
idLength
in interface Annotations
intf
- the interface to find the project code on.public boolean hasCauseAnnotation(VariableElement param)
Annotations
hasCauseAnnotation
in interface Annotations
param
- the parameter to checktrue
if the method has a cause annotation, otherwise false
public boolean hasFieldAnnotation(VariableElement param)
Annotations
hasFieldAnnotation
in interface Annotations
param
- the parameter to checktrue
if the method has a field annotation, otherwise false
public boolean hasLoggingClassAnnotation(VariableElement param)
Annotations
hasLoggingClassAnnotation
in interface Annotations
param
- the parameter to checktrue
if the method has a logging class annotation, otherwise false
public boolean hasMessageAnnotation(ExecutableElement method)
Annotations
hasMessageAnnotation
in interface Annotations
method
- the method to checktrue
if the annotation was found, otherwise false
public boolean hasMessageId(ExecutableElement method)
Annotations
hasMessageId
in interface Annotations
method
- the method to check.true
if the message id was found, otherwise false
.public boolean hasParamAnnotation(VariableElement param)
Annotations
hasParamAnnotation
in interface Annotations
param
- the parameter to checktrue
if the method has a parameter annotation, otherwise false
public boolean hasPropertyAnnotation(VariableElement param)
Annotations
hasPropertyAnnotation
in interface Annotations
param
- the parameter to checktrue
if the method has a property annotation, otherwise false
public boolean inheritsMessageId(ExecutableElement method)
Annotations
inheritsMessageId
in interface Annotations
method
- the method to check.true
if the message id should be inherited, otherwise false
.public boolean isLoggerMethod(ExecutableElement method)
Annotations
isLoggerMethod
in interface Annotations
method
- the method to checktrue
if the method is a logger method, otherwise false
public boolean isMessageBundle(TypeElement element)
Annotations
element
to see it's a message bundle.isMessageBundle
in interface Annotations
element
- the interface elementtrue
if the interface is a message bundlepublic boolean isMessageLogger(TypeElement element)
Annotations
element
to see it's a message logger.isMessageLogger
in interface Annotations
element
- the interface elementtrue
if the interface is a message loggerpublic String getFormatWithAnnotationName(VariableElement param)
Annotations
@FormatWith
class.getFormatWithAnnotationName
in interface Annotations
param
- the parameter elementpublic String getMessageLoggerAnnotationName(TypeElement element)
Annotations
@MessageLogger
class.getMessageLoggerAnnotationName
in interface Annotations
element
- the interface elementpublic int messageId(ExecutableElement method)
Annotations
messageId
in interface Annotations
method
- the method to check.public String messageValue(ExecutableElement method)
Annotations
messageValue
in interface Annotations
method
- the method to check.null
is
returned.public String loggerMethod(Annotations.FormatType formatType)
Annotations
loggerMethod
in interface Annotations
formatType
- the format type for the method.public String logLevel(ExecutableElement method)
Annotations
logLevel
in interface Annotations
method
- the method used to determine the log method.public String targetName(VariableElement param)
Annotations
Field
or
Property
an empty string should be returned.
If the parameter is annotated with Property
, the name should
be prepended with set
. For example a property name of value
should return setValue
.
If the annotation does not have a defined value, the parameter name should be returned.targetName
in interface Annotations
param
- the parameter to check for the annotation.Copyright © 2023 JBoss by Red Hat. All rights reserved.