Package serp.bytecode
Class Annotations
java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Attribute
serp.bytecode.Annotations
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
Java annotation data.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisit
(BCVisitor visit) Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.addAnnotation
(Class type) Add a new annotation.addAnnotation
(String type) Add a new annotation.Import an annotation from another instance.addAnnotation
(BCClass type) Add a new annotation.void
clear()
Remove all annotations.getAnnotation
(Class type) Return the annotation of the given type, or null if none.getAnnotation
(String type) Return the annotation of the given type, or null if none.getAnnotation
(BCClass type) Return the annotation of the given type, or null if none.All declared annotations.(package private) int
Return the length of the bytecode representation of this attribute in bytes, excluding the name index.boolean
Whether these annotations are runtime-visible.(package private) void
Read the attribute bytecode from the given stream, up to length bytes, excluding the name index.(package private) void
Copy the information from the given attribute to this one.boolean
removeAnnotation
(Class type) Remove the annotation of the given type.boolean
removeAnnotation
(String type) Remove the annotation of the given type.boolean
removeAnnotation
(Annotation anno) Remove the given annotation.boolean
removeAnnotation
(BCClass type) Remove the annotation of the given type.void
setAnnotations
(Annotation[] annos) Set the annotations.(package private) void
write
(DataOutput out, int length) Write the attribute bytecode to the given stream, up to length bytes, excluding the name index.Methods inherited from class serp.bytecode.Attribute
create, getAttributesHolder, getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, invalidate, isValid
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, readAttributes, removeAttribute, removeAttribute, setAttributes, visitAttributes, writeAttributes
-
Field Details
-
_annotations
-
-
Constructor Details
-
Annotations
Annotations(int nameIndex, Attributes owner)
-
-
Method Details
-
isRuntime
public boolean isRuntime()Whether these annotations are runtime-visible. -
getAnnotations
All declared annotations. -
setAnnotations
Set the annotations. This method is useful when importing annotations from another instance. -
getAnnotation
Return the annotation of the given type, or null if none. -
getAnnotation
Return the annotation of the given type, or null if none. -
getAnnotation
Return the annotation of the given type, or null if none. -
addAnnotation
Import an annotation from another instance.- Returns:
- the newly added annotation
-
addAnnotation
Add a new annotation. -
addAnnotation
Add a new annotation. -
addAnnotation
Add a new annotation. -
clear
public void clear()Remove all annotations. -
removeAnnotation
Remove the given annotation.- Returns:
- true if an annotation was removed, false otherwise
-
removeAnnotation
Remove the annotation of the given type.- Returns:
- true if an annotation was removed, false otherwise
-
removeAnnotation
Remove the annotation of the given type.- Returns:
- true if an annotation was removed, false otherwise
-
removeAnnotation
Remove the annotation of the given type.- Returns:
- true if an annotation was removed, false otherwise
-
getLength
int getLength()Description copied from class:Attribute
Return the length of the bytecode representation of this attribute in bytes, excluding the name index. -
read
Description copied from class:Attribute
Copy the information from the given attribute to this one. Does nothing by default. -
read
Description copied from class:Attribute
Read the attribute bytecode from the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
read
in classAttribute
- Throws:
IOException
-
write
Description copied from class:Attribute
Write the attribute bytecode to the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
write
in classAttribute
- Throws:
IOException
-
acceptVisit
Description copied from interface:VisitAcceptor
Accept a visit from aBCVisitor
, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
-