Lombok - v0.10.8

lombok.core
Class AnnotationValues<A extends Annotation>

java.lang.Object
  extended by lombok.core.AnnotationValues<A>

public class AnnotationValues<A extends Annotation>
extends Object

Represents a single annotation in a source file and can be used to query the parameters present on it.


Nested Class Summary
static class AnnotationValues.AnnotationValue
          Represents a single method on the annotation class.
static class AnnotationValues.AnnotationValueDecodeFail
          Thrown on the fly if an actual annotation instance procured via the getInstance() method is queried for a method for which this AnnotationValues instance either doesn't have a guess or can't manage to fit the guess into the required data type.
 
Constructor Summary
AnnotationValues(Class<A> type, Map<String,AnnotationValues.AnnotationValue> values, LombokNode<?,?,?> ast)
          Creates a new AnnotationValues.
 
Method Summary
 Object getActualExpression(String annotationMethodName)
          Convenience method to return the first result in a getActualExpressions(String) call.
 List<Object> getActualExpressions(String annotationMethodName)
          Returns the actual expressions used for the provided annotationMethodName.
 A getInstance()
          Creates an actual annotation instance.
 String getProbableFQType(String annotationMethodName)
          Convenience method to return the first result in a getProbableFQType(String) call.
 List<String> getProbableFQTypes(String annotationMethodName)
          Attempts to translate class literals to their fully qualified names, such as 'Throwable.class' to 'java.lang.Throwable'.
 String getRawExpression(String annotationMethodName)
          Convenience method to return the first result in a getRawExpressions(String) call.
 List<String> getRawExpressions(String annotationMethodName)
          Returns the raw expressions used for the provided annotationMethodName.
 boolean isExplicit(String annotationMethodName)
           
 void setError(String annotationMethodName, String message)
          Generates an error message on the stated annotation value (you should only call this method if you know it's there!)
 void setError(String annotationMethodName, String message, int index)
          Generates an error message on the stated annotation value, which must have an array initializer.
 void setWarning(String annotationMethodName, String message)
          Generates a warning message on the stated annotation value (you should only call this method if you know it's there!)
 void setWarning(String annotationMethodName, String message, int index)
          Generates a warning message on the stated annotation value, which must have an array initializer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationValues

public AnnotationValues(Class<A> type,
                        Map<String,AnnotationValues.AnnotationValue> values,
                        LombokNode<?,?,?> ast)
Creates a new AnnotationValues.

Parameters:
type - The annotation type. For example, "Getter.class"
values - a Map of method names to AnnotationValue instances, for example 'value -> annotationValue instance'.
ast - The Annotation node.
Method Detail

getInstance

public A getInstance()
Creates an actual annotation instance. You can use this to query any annotation methods, except for those annotation methods with class literals, as those can most likely not be turned into Class objects. If some of the methods cannot be implemented, this method still works; it's only when you call a method that has a problematic value that an AnnotationValueDecodeFail exception occurs.


getRawExpressions

public List<String> getRawExpressions(String annotationMethodName)
Returns the raw expressions used for the provided annotationMethodName. You should use this method for annotation methods that return Class objects. Remember that class literals end in ".class" which you probably want to strip off.


getActualExpressions

public List<Object> getActualExpressions(String annotationMethodName)
Returns the actual expressions used for the provided annotationMethodName.


isExplicit

public boolean isExplicit(String annotationMethodName)

getRawExpression

public String getRawExpression(String annotationMethodName)
Convenience method to return the first result in a getRawExpressions(String) call. You should use this method if the annotation method is not an array type.


getActualExpression

public Object getActualExpression(String annotationMethodName)
Convenience method to return the first result in a getActualExpressions(String) call. You should use this method if the annotation method is not an array type.


setError

public void setError(String annotationMethodName,
                     String message)
Generates an error message on the stated annotation value (you should only call this method if you know it's there!)


setWarning

public void setWarning(String annotationMethodName,
                       String message)
Generates a warning message on the stated annotation value (you should only call this method if you know it's there!)


setError

public void setError(String annotationMethodName,
                     String message,
                     int index)
Generates an error message on the stated annotation value, which must have an array initializer. The index-th item in the initializer will carry the error (you should only call this method if you know it's there!)


setWarning

public void setWarning(String annotationMethodName,
                       String message,
                       int index)
Generates a warning message on the stated annotation value, which must have an array initializer. The index-th item in the initializer will carry the error (you should only call this method if you know it's there!)


getProbableFQTypes

public List<String> getProbableFQTypes(String annotationMethodName)
Attempts to translate class literals to their fully qualified names, such as 'Throwable.class' to 'java.lang.Throwable'. This process is at best a guess, but it will take into account import statements.


getProbableFQType

public String getProbableFQType(String annotationMethodName)
Convenience method to return the first result in a getProbableFQType(String) call. You should use this method if the annotation method is not an array type.


Lombok - v0.10.8

Copyright © 2009-2011 The Project Lombok Authors, licensed under the MIT licence.