public class AnnotationsAttribute extends AttributeInfo
| Modifier and Type | Class and Description |
|---|---|
static class |
AnnotationsAttribute.Copier |
static class |
AnnotationsAttribute.Parser |
static class |
AnnotationsAttribute.Walker |
| Modifier and Type | Field and Description |
|---|---|
static String |
invisibleTag
The name of the
RuntimeInvisibleAnnotations attribute. |
static String |
visibleTag
The name of the
RuntimeVisibleAnnotations attribute. |
constPool, info, name| Constructor and Description |
|---|
AnnotationsAttribute(ConstPool cp,
int n,
DataInput in) |
AnnotationsAttribute(ConstPool cp,
String attrname)
Constructs an empty
Runtime(In)VisibleAnnotations_attribute. |
AnnotationsAttribute(ConstPool cp,
String attrname,
byte[] info)
Constructs a
Runtime(In)VisibleAnnotations_attribute. |
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(Annotation annotation)
Adds an annotation.
|
AttributeInfo |
copy(ConstPool newCp,
Map<?,?> classnames)
Copies this attribute and returns a new copy.
|
Annotation |
getAnnotation(String type)
Parses the annotations and returns a data structure representing
the annotation with the specified type.
|
Annotation[] |
getAnnotations()
Parses the annotations and returns a data structure representing
that parsed annotations.
|
int |
numAnnotations()
Returns
num_annotations. |
void |
setAnnotation(Annotation annotation)
Changes the annotations.
|
void |
setAnnotations(Annotation[] annotations)
Changes the annotations represented by this object according to
the given array of
Annotation objects. |
String |
toString()
Returns a string representation of this object.
|
copyAll, get, getConstPool, getLength, getName, length, lookup, read, remove, renameClass, renameClass, set, writeAllpublic static final String visibleTag
RuntimeVisibleAnnotations attribute.public static final String invisibleTag
RuntimeInvisibleAnnotations attribute.public AnnotationsAttribute(ConstPool cp, String attrname, byte[] info)
Runtime(In)VisibleAnnotations_attribute.cp - constant poolattrname - attribute name (visibleTag or
invisibleTag).info - the contents of this attribute. It does not
include attribute_name_index or
attribute_length.public AnnotationsAttribute(ConstPool cp, String attrname)
Runtime(In)VisibleAnnotations_attribute.
A new annotation can be later added to the created attribute
by setAnnotations().cp - constant poolattrname - attribute name (visibleTag or
invisibleTag).setAnnotations(Annotation[])public AnnotationsAttribute(ConstPool cp, int n, DataInput in) throws IOException
n - the attribute name.IOExceptionpublic int numAnnotations()
num_annotations.public AttributeInfo copy(ConstPool newCp, Map<?,?> classnames)
copy in class AttributeInfonewCp - the constant pool table used by the new copy.classnames - pairs of replaced and substituted
class names.public Annotation getAnnotation(String type)
getAnnotations() as to the returned data structure.type - the annotation type.getAnnotations()public void addAnnotation(Annotation annotation)
annotation - the added annotation.public Annotation[] getAnnotations()
setAnnotations().setAnnotations(Annotation[])public void setAnnotations(Annotation[] annotations)
Annotation objects.annotations - the data structure representing the
new annotations.public void setAnnotation(Annotation annotation)
setAnnotations(new Annotation[] { annotation })annotation - the data structure representing
the new annotation.Copyright © December 07, 2012–2015 The Internet Party. All rights reserved.