Top Description Fields Constructors Methods
org.apache.bcel.classfile

public abstract Class Annotations

extends Attribute
implements Iterable<AnnotationEntry>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Known Direct Subclasses
org.apache.bcel.classfile.RuntimeInvisibleAnnotations, org.apache.bcel.classfile.RuntimeVisibleAnnotations
Imports
java.io.DataInput, .DataOutputStream, .IOException, java.util.Iterator, java.util.stream.Stream, org.apache.bcel.Const

base class for annotations
Since
6.0

Field Summary

Modifier and TypeField and Description
private AnnotationEntry[]
private final boolean
Inherited from org.apache.bcel.classfile.Attribute:
constant_poolEMPTY_ARRAYlengthname_indextag

Constructor Summary

AccessConstructor and Description
public
Annotations(final byte
the subclass type of the annotation
annotationType
,
final int
Index pointing to the name Code
nameIndex
,
final int
Content length in bytes
length
,
final AnnotationEntry[]
the actual annotations
annotationTable
,
final ConstantPool
Array of constants
constantPool
,
final boolean
whether this Annotation visible at runtime
isRuntimeVisible
)

Constructs an instance.

pack-priv
Annotations(final byte
the subclass type of the annotation
annotationType
,
final int
Index pointing to the name Code
nameIndex
,
final int
Content length in bytes
length
,
final DataInput
Input stream
input
,
final ConstantPool
Array of constants
constantPool
,
final boolean
whether this Annotation visible at runtime
isRuntimeVisible
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract org.apache.bcel.classfile.Attribute.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
public Attribute
copy(final ConstantPool
constant pool to save.
constantPool
)

Implements abstract org.apache.bcel.classfile.Attribute.copy.

public AnnotationEntry[]
getAnnotationEntries()

Gets the array of annotation entries in this annotation

public final int

Returns:

the number of annotation entries in this annotation
getNumAnnotations
()

Gets the number of annotation entries in this annotation.

public boolean
public Iterator<AnnotationEntry>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public final void
setAnnotationTable(final AnnotationEntry[]
the entries to set in this annotation
annotationTable
)

Sets the entries to set in this annotation.

public final String

Returns:

String representation
toString
()

Overrides org.apache.bcel.classfile.Attribute.toString.

Converts to a String representation.
protected void
Inherited from org.apache.bcel.classfile.Attribute:
addAttributeReaderaddAttributeReaderclonedumpgetConstantPoolgetLengthgetNamegetNameIndexgetTagprintlnreadAttributereadAttributeremoveAttributeReadersetConstantPoolsetLengthsetNameIndex

Field Detail

annotationTableback to summary
private AnnotationEntry[] annotationTable
isRuntimeVisibleback to summary
private final boolean isRuntimeVisible

Constructor Detail

Annotationsback to summary
public Annotations(final byte annotationType, final int nameIndex, final int length, final AnnotationEntry[] annotationTable, final ConstantPool constantPool, final boolean isRuntimeVisible)

Constructs an instance.

Parameters
annotationType:byte

the subclass type of the annotation

nameIndex:int

Index pointing to the name Code

length:int

Content length in bytes

annotationTable:AnnotationEntry[]

the actual annotations

constantPool:ConstantPool

Array of constants

isRuntimeVisible:boolean

whether this Annotation visible at runtime

Annotationsback to summary
pack-priv Annotations(final byte annotationType, final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool, final boolean isRuntimeVisible) throws IOException

Constructs an instance.

Parameters
annotationType:byte

the subclass type of the annotation

nameIndex:int

Index pointing to the name Code

length:int

Content length in bytes

input:DataInput

Input stream

constantPool:ConstantPool

Array of constants

isRuntimeVisible:boolean

whether this Annotation visible at runtime

Exceptions
IOException:
if an I/O error occurs.

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract org.apache.bcel.classfile.Attribute.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
copyback to summary
public Attribute copy(final ConstantPool constantPool)

Implements abstract org.apache.bcel.classfile.Attribute.copy.

Parameters
constantPool:ConstantPool

Doc from org.apache.bcel.classfile.Attribute.copy.

constant pool to save.

Returns:Attribute

Doc from org.apache.bcel.classfile.Attribute.copy.

deep copy of this attribute.

Annotations
@Override
getAnnotationEntriesback to summary
public AnnotationEntry[] getAnnotationEntries()

Gets the array of annotation entries in this annotation

getNumAnnotationsback to summary
public final int getNumAnnotations()

Gets the number of annotation entries in this annotation.

Returns:int

the number of annotation entries in this annotation

isRuntimeVisibleback to summary
public boolean isRuntimeVisible()
iteratorback to summary
public Iterator<AnnotationEntry> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<AnnotationEntry>

an Iterator.

Annotations
@Override
setAnnotationTableback to summary
public final void setAnnotationTable(final AnnotationEntry[] annotationTable)

Sets the entries to set in this annotation.

Parameters
annotationTable:AnnotationEntry[]

the entries to set in this annotation

toStringback to summary
public final String toString()

Overrides org.apache.bcel.classfile.Attribute.toString.

Converts to a String representation.

Returns:String

String representation

Annotations
@Override
writeAnnotationsback to summary
protected void writeAnnotations(final DataOutputStream dos) throws IOException