Package serp.bytecode

# Class Annotations

java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Attribute
serp.bytecode.Annotations

All Implemented Interfaces:
  `BCEntity`, `VisitAcceptor`

public class Annotations extends Attribute
Java annotation data.

Author:
  Abe White

## Method Summary

Modifier and Type
Method
Description
`void`
`acceptVisit(BCVisitor visit)`
Accept a visit from a `BCVisitor`, 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.
`Annotation`
`addAnnotation(Class type)`
Add a new annotation.
`Annotation`
`addAnnotation(String type)`
Add a new annotation.
`Annotation`
`addAnnotation(Annotation an)`
Import an annotation from another instance.
`Annotation`
`addAnnotation(BCClass type)`
Add a new annotation.
`void`
`clear()`
Remove all annotations.
`Annotation`
`getAnnotation(Class type)`
Return the annotation of the given type, or null if none.
`Annotation`
`getAnnotation(String type)`
Return the annotation of the given type, or null if none.
`Annotation`
`getAnnotation(BCClass type)`
Return the annotation of the given type, or null if none.
`Annotation[]`
`getAnnotations()`
All declared annotations.
`boolean`
`isRuntime()`
Whether these annotations are runtime-visible.
`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.

### Methods inherited from class serp.bytecode.Attribute

`getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, isValid`

### Methods inherited from class serp.bytecode.Attributes

`addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, removeAttribute, removeAttribute, setAttributes`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### isRuntime

public boolean isRuntime()
Whether these annotations are runtime-visible.

### getAnnotations

public Annotation[] getAnnotations()
All declared annotations.

### setAnnotations

public void setAnnotations(Annotation[] annos)
Set the annotations. This method is useful when importing annotations from another instance.

### getAnnotation

public Annotation getAnnotation(Class type)
Return the annotation of the given type, or null if none.

### getAnnotation

public Annotation getAnnotation(BCClass type)
Return the annotation of the given type, or null if none.

### getAnnotation

public Annotation getAnnotation(String type)
Return the annotation of the given type, or null if none.

### addAnnotation

public Annotation addAnnotation(Annotation an)
Import an annotation from another instance.

Returns:
  the newly added annotation

### addAnnotation

public Annotation addAnnotation(Class type)
Add a new annotation.

### addAnnotation

public Annotation addAnnotation(BCClass type)
Add a new annotation.

### addAnnotation

public Annotation addAnnotation(String type)
Add a new annotation.

### clear

public void clear()
Remove all annotations.

### removeAnnotation

public boolean removeAnnotation(Annotation anno)
Remove the given annotation.

Returns:
  true if an annotation was removed, false otherwise

### removeAnnotation

public boolean removeAnnotation(Class type)
Remove the annotation of the given type.

Returns:
  true if an annotation was removed, false otherwise

### removeAnnotation

public boolean removeAnnotation(BCClass type)
Remove the annotation of the given type.

Returns:
  true if an annotation was removed, false otherwise

### removeAnnotation

public boolean removeAnnotation(String type)
Remove the annotation of the given type.

Returns:
  true if an annotation was removed, false otherwise

### acceptVisit

public void acceptVisit(BCVisitor visit)
Description copied from interface: `VisitAcceptor`
Accept a visit from a `BCVisitor`, 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.