checkers.util
Class AnnotationUtils.AnnotationBuilder
java.lang.Object
checkers.util.AnnotationUtils.AnnotationBuilder
- Enclosing class:
- AnnotationUtils
public static class AnnotationUtils.AnnotationBuilder
- extends Object
Builds an annotation mirror that may have some values.
Constructing an AnnotationMirror
requires:
1. Constructing the builder with the desired annotation class
2. Setting each value individually using SetValue
methods
3. Calling build()
to get the annotation build so far
Once an annotation is built, no further modification or calls to
build can be made. Otherwise, a IllegalStateException
.
All setter methods throw IllegalArgumentException
if the
specified element is not found, or that the given value is not a
subtype of the expected type.
TODO: Doesn't type check arrays yet
Method Summary |
AnnotationMirror |
build()
|
void |
setValue(CharSequence elementName,
AnnotationMirror value)
|
void |
setValue(CharSequence elementName,
Boolean value)
|
void |
setValue(CharSequence elementName,
Character value)
|
void |
setValue(CharSequence elementName,
Double value)
|
void |
setValue(CharSequence elementName,
Float value)
|
void |
setValue(CharSequence elementName,
Integer value)
|
void |
setValue(CharSequence elementName,
List<? extends Object> values)
|
void |
setValue(CharSequence elementName,
Long value)
|
void |
setValue(CharSequence elementName,
Object[] values)
|
void |
setValue(CharSequence elementName,
Short value)
|
void |
setValue(CharSequence elementName,
String value)
|
void |
setValue(CharSequence elementName,
TypeMirror value)
|
void |
setValue(CharSequence elementName,
VariableElement value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AnnotationUtils.AnnotationBuilder
public AnnotationUtils.AnnotationBuilder(ProcessingEnvironment env,
Class<? extends Annotation> anno)
AnnotationUtils.AnnotationBuilder
public AnnotationUtils.AnnotationBuilder(ProcessingEnvironment env,
CharSequence name)
AnnotationUtils.AnnotationBuilder
public AnnotationUtils.AnnotationBuilder(ProcessingEnvironment env,
AnnotationMirror annotation)
build
public AnnotationMirror build()
setValue
public void setValue(CharSequence elementName,
AnnotationMirror value)
setValue
public void setValue(CharSequence elementName,
List<? extends Object> values)
setValue
public void setValue(CharSequence elementName,
Object[] values)
setValue
public void setValue(CharSequence elementName,
Boolean value)
setValue
public void setValue(CharSequence elementName,
Character value)
setValue
public void setValue(CharSequence elementName,
Double value)
setValue
public void setValue(CharSequence elementName,
VariableElement value)
setValue
public void setValue(CharSequence elementName,
Float value)
setValue
public void setValue(CharSequence elementName,
Integer value)
setValue
public void setValue(CharSequence elementName,
Long value)
setValue
public void setValue(CharSequence elementName,
Short value)
setValue
public void setValue(CharSequence elementName,
String value)
setValue
public void setValue(CharSequence elementName,
TypeMirror value)