Package gnu.bytecode
Class RuntimeAnnotationsAttr
java.lang.Object
gnu.bytecode.Attribute
gnu.bytecode.RuntimeAnnotationsAttr
Represents a "RuntimeVisibleAnnotations" or "RuntimeInvisibleAnnotations" attribute.
-
Constructor Summary
ConstructorsConstructorDescriptionRuntimeAnnotationsAttr(String name, AnnotationEntry[] entries, int numEntries, AttrContainer container) Add a new AnnotationAttr to a Member. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an annotation to this attribute.voidAdd any needed constant pool entries for this Attribute.static <T extends Annotation>
TgetAnnotation(AttrContainer container, Class<T> clas) <T extends Annotation>
TgetAnnotation(Class<T> clas) static RuntimeAnnotationsAttrgetAnnotationsAttr(AttrContainer container, String name) intReturn the length of the attribute in bytes.static RuntimeAnnotationsAttrgetRuntimeInvisibleAnnotations(AttrContainer container) Get or create a RuntimeInvisibleAnnotations attribute.static RuntimeAnnotationsAttrgetRuntimeVisibleAnnotations(AttrContainer container) Get or create a RuntimeVisibleAnnotations attribute.static voidmaybeAddAnnotation(AttrContainer container, AnnotationEntry annotation) Add to appropriate annotations attribute.voidprint(ClassTypeWriter dst) voidwrite(DataOutputStream dstr) Write out the contents of the Attribute.Methods inherited from class gnu.bytecode.Attribute
addToFrontOf, assignConstants, count, get, getConstants, getContainer, getLengthAll, getName, getNameIndex, getNext, isSkipped, setContainer, setName, setNameIndex, setNext, setSkipped, setSkipped, writeAll
-
Constructor Details
-
RuntimeAnnotationsAttr
public RuntimeAnnotationsAttr(String name, AnnotationEntry[] entries, int numEntries, AttrContainer container) Add a new AnnotationAttr to a Member.
-
-
Method Details
-
getAnnotationsAttr
-
getRuntimeVisibleAnnotations
Get or create a RuntimeVisibleAnnotations attribute. -
getRuntimeInvisibleAnnotations
Get or create a RuntimeInvisibleAnnotations attribute. -
getAnnotation
-
getAnnotation
-
maybeAddAnnotation
Add to appropriate annotations attribute. If the annotation's retention policy isRUNTIME, add to theRuntimeVisibleAnnotationsattribute. If the annotation's retention policy isCLASS, add to theRuntimeInvisibleAnnotationsattribute. Otherwise, ignore the annotation. -
addAnnotation
Add an annotation to this attribute. -
getLength
public int getLength()Return the length of the attribute in bytes. Does not include the 6-byte header (for the name_index and the length). -
print
-
assignConstants
Description copied from class:AttributeAdd any needed constant pool entries for this Attribute. Overridden by sub-classes. Do any other cleanup needed before writing out a .class file.- Overrides:
assignConstantsin classAttribute
-
write
Description copied from class:AttributeWrite out the contents of the Attribute. Does not write the 6-byte attribute header.- Specified by:
writein classAttribute- Throws:
IOException
-