JBoss Logging I18n Annotation Processor 1.1.0.Final

org.jboss.logging.processor.apt
Class AnnotationsImpl

java.lang.Object
  extended by org.jboss.logging.processor.apt.AnnotationsImpl
All Implemented Interfaces:
Annotations

public class AnnotationsImpl
extends Object
implements Annotations

An implementation for an annotation processor.

This implementation handles both local annotations and deprecated annotations that were part of the jboss-logging project.

Author:
James R. Perkins

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.logging.processor.apt.Annotations
Annotations.FormatType, Annotations.Void
 
Constructor Summary
AnnotationsImpl()
           
 
Method Summary
 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.
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationsImpl

public AnnotationsImpl()
Method Detail

getSupportedAnnotations

public Set<String> getSupportedAnnotations()
Description copied from interface: Annotations
Returns a set of the supported annotations.

Specified by:
getSupportedAnnotations in interface Annotations
Returns:

messageFormat

public Annotations.FormatType messageFormat(ExecutableElement method)
Description copied from interface: Annotations
Returns the method format type.

Specified by:
messageFormat in interface Annotations
Parameters:
method - the method with the Message annotation.
Returns:
the format type of the message or null if the format type was not found.

projectCode

public String projectCode(TypeElement intf)
Description copied from interface: Annotations
The project code from the interface.

Specified by:
projectCode in interface Annotations
Parameters:
intf - the interface to find the project code on.
Returns:
the project code or null if one was not found.

hasCauseAnnotation

public boolean hasCauseAnnotation(VariableElement param)
Description copied from interface: Annotations
Checks to see if the parameter has a cause annotation.

Specified by:
hasCauseAnnotation in interface Annotations
Parameters:
param - the parameter to check
Returns:
true if the method has a cause annotation, otherwise false

hasFieldAnnotation

public boolean hasFieldAnnotation(VariableElement param)
Description copied from interface: Annotations
Checks to see if the parameter has a field annotation.

Specified by:
hasFieldAnnotation in interface Annotations
Parameters:
param - the parameter to check
Returns:
true if the method has a field annotation, otherwise false

hasLoggingClassAnnotation

public boolean hasLoggingClassAnnotation(VariableElement param)
Description copied from interface: Annotations
Checks to see if the parameter has a logging class annotation.

Specified by:
hasLoggingClassAnnotation in interface Annotations
Parameters:
param - the parameter to check
Returns:
true if the method has a logging class annotation, otherwise false

hasMessageAnnotation

public boolean hasMessageAnnotation(ExecutableElement method)
Description copied from interface: Annotations
Checks to see if the method is annotated with the message annotation.

Specified by:
hasMessageAnnotation in interface Annotations
Parameters:
method - the method to check
Returns:
true if the annotation was found, otherwise false

hasMessageId

public boolean hasMessageId(ExecutableElement method)
Description copied from interface: Annotations
Checks to see if the method has a message id.

Specified by:
hasMessageId in interface Annotations
Parameters:
method - the method to check.
Returns:
true if the message id was found, otherwise false.

hasParamAnnotation

public boolean hasParamAnnotation(VariableElement param)
Description copied from interface: Annotations
Checks to see if the parameter has a parameter annotation.

Specified by:
hasParamAnnotation in interface Annotations
Parameters:
param - the parameter to check
Returns:
true if the method has a parameter annotation, otherwise false

hasPropertyAnnotation

public boolean hasPropertyAnnotation(VariableElement param)
Description copied from interface: Annotations
Checks to see if the parameter has a property annotation.

Specified by:
hasPropertyAnnotation in interface Annotations
Parameters:
param - the parameter to check
Returns:
true if the method has a property annotation, otherwise false

inheritsMessageId

public boolean inheritsMessageId(ExecutableElement method)
Description copied from interface: Annotations
Checks to see if the method should inherit the message id from a different method if applicable.

Specified by:
inheritsMessageId in interface Annotations
Parameters:
method - the method to check.
Returns:
true if the message id should be inherited, otherwise false.

isLoggerMethod

public boolean isLoggerMethod(ExecutableElement method)
Description copied from interface: Annotations
Checks to see if the method is a logger method.

Specified by:
isLoggerMethod in interface Annotations
Parameters:
method - the method to check
Returns:
true if the method is a logger method, otherwise false

isMessageBundle

public boolean isMessageBundle(TypeElement element)
Description copied from interface: Annotations
Checks the element to see it's a message bundle.

Specified by:
isMessageBundle in interface Annotations
Parameters:
element - the interface element
Returns:
true if the interface is a message bundle

isMessageLogger

public boolean isMessageLogger(TypeElement element)
Description copied from interface: Annotations
Checks the element to see it's a message logger.

Specified by:
isMessageLogger in interface Annotations
Parameters:
element - the interface element
Returns:
true if the interface is a message logger

getFormatWithAnnotationName

public String getFormatWithAnnotationName(VariableElement param)
Description copied from interface: Annotations
Returns the name of the @FormatWith class.

Specified by:
getFormatWithAnnotationName in interface Annotations
Parameters:
param - the parameter element
Returns:
the name of the class

getMessageLoggerAnnotationName

public String getMessageLoggerAnnotationName(TypeElement element)
Description copied from interface: Annotations
Returns the name of the @MessageLogger class.

Specified by:
getMessageLoggerAnnotationName in interface Annotations
Parameters:
element - the interface element
Returns:
the name of the class

messageId

public int messageId(ExecutableElement method)
Description copied from interface: Annotations
Returns the message id.

Specified by:
messageId in interface Annotations
Parameters:
method - the method to check.
Returns:
the message id or 0 if one was not found.

messageValue

public String messageValue(ExecutableElement method)
Description copied from interface: Annotations
Returns the message value for the method.

Specified by:
messageValue in interface Annotations
Parameters:
method - the method to check.
Returns:
the message for the method, if no method found null is returned.

loggerMethod

public String loggerMethod(Annotations.FormatType formatType)
Description copied from interface: Annotations
Returns the logger method name to use or an empty string if the method is not a logger method.

Specified by:
loggerMethod in interface Annotations
Parameters:
formatType - the format type for the method.
Returns:
the name of the logger method or an empty string.

logLevel

public String logLevel(ExecutableElement method)
Description copied from interface: Annotations
Returns the log level enum. For example Logger.Level.INFO.

Specified by:
logLevel in interface Annotations
Parameters:
method - the method used to determine the log method.
Returns:
the log level.

targetName

public String targetName(VariableElement param)
Description copied from interface: Annotations
Returns the target field or method name for the annotated parameter. If the parameter is not annotated with either 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.

Specified by:
targetName in interface Annotations
Parameters:
param - the parameter to check for the annotation.
Returns:
the field, method name or an empty string.

JBoss Logging I18n Annotation Processor 1.1.0.Final

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.