com.vladium.jcd.cls
Interface IAttributeCollection

All Superinterfaces:
java.lang.Cloneable, IClassFormatOutput
All Known Implementing Classes:
AttributeCollection

public interface IAttributeCollection
extends java.lang.Cloneable, IClassFormatOutput

An abstraction of the 'attributes' component of .class format. The contents are Attribute_info structures. The order in which they appear is unspecified.

Author:
(C) 2001, Vlad Roubtsov

Method Summary
 void accept(IClassDefVisitor visitor, java.lang.Object ctx)
           
 int add(Attribute_info attribute)
          Adds a new Attribute_info descriptor to this collection.
 java.lang.Object clone()
           
 Attribute_info get(int offset)
          Returns the attribute descriptor at a given offset.
 InnerClassesAttribute_info getInnerClassesAttribute()
           
 boolean hasBridge()
           
 boolean hasSynthetic()
           
 long length()
          Returns the total length of this collection when converted to .class format [including 2 count bytes]
 Attribute_info remove(int offset)
          Removes the Attribute_info descriptor at a given offset.
 Attribute_info set(int offset, Attribute_info attribute)
          Replaces the Attribute_info descriptor at a given offset.
 int size()
          Returns the number of attributes in this collection [can be 0].
 
Methods inherited from interface com.vladium.jcd.compiler.IClassFormatOutput
writeInClassFormat
 

Method Detail

get

Attribute_info get(int offset)
Returns the attribute descriptor at a given offset.

Parameters:
offset - attribute offset [must be in [0, size()) range; input not checked]
Returns:
Attribute_info descriptor [never null]
Throws:
java.lang.IndexOutOfBoundsException - if 'offset' is outside of valid range

hasSynthetic

boolean hasSynthetic()

hasBridge

boolean hasBridge()

getInnerClassesAttribute

InnerClassesAttribute_info getInnerClassesAttribute()

size

int size()
Returns the number of attributes in this collection [can be 0].


length

long length()
Returns the total length of this collection when converted to .class format [including 2 count bytes]


clone

java.lang.Object clone()

accept

void accept(IClassDefVisitor visitor,
            java.lang.Object ctx)

add

int add(Attribute_info attribute)
Adds a new Attribute_info descriptor to this collection. No duplicate checks are made. It is the responsibility of the caller to ensure that all data referenced in 'attribute' will eventually appear in the constant pool.

Parameters:
attribute - new attribute descriptor [may not be null]

set

Attribute_info set(int offset,
                   Attribute_info attribute)
Replaces the Attribute_info descriptor at a given offset. No duplicate checks are made. It is the responsibility of the caller to ensure that all data referenced in 'attribute' will eventually appear in the constant pool.

Parameters:
offset - attribute offset [must be in [0, size()) range; input not checked]
attribute - new attribute descriptor [may not be null]
Returns:
previous attribute descriptor at this offset [never null]
Throws:
java.lang.IndexOutOfBoundsException - if 'offset' is outside of valid range

remove

Attribute_info remove(int offset)
Removes the Attribute_info descriptor at a given offset.

Parameters:
offset - attribute offset [must be in [0, size()) range; input not checked]
Returns:
current attribute descriptor at this offset [never null]
Throws:
java.lang.IndexOutOfBoundsException - if 'offset' is outside of valid range