public interface IConstantCollection extends java.lang.Cloneable, IClassFormatOutput
| Modifier and Type | Interface and Description |
|---|---|
static interface |
IConstantCollection.IConstantComparator
A simple interface to express custom semantics of constant equality.
|
static interface |
IConstantCollection.IConstantIterator
A custom fail-fast iterator class returned by
iterator(). |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(IClassDefVisitor visitor,
java.lang.Object ctx) |
int |
add(CONSTANT_info constant)
Appends 'constant' to the end of the collection.
|
java.lang.Object |
clone() |
int |
find(int type,
IConstantCollection.IConstantComparator comparator)
Searches the pool for a matching constant of given type with equality
semantics expressed by 'comparator'.
|
int |
findCONSTANT_Utf8(java.lang.String value)
Convenience method that can lookup CONSTANT_Utf8 entries in O(1) time
on average.
|
CONSTANT_info |
get(int index)
Returns a CONSTANT_info at a given pool index.
|
IConstantCollection.IConstantIterator |
iterator()
Returns a fail-fast iterator over all valid entries in the pool.
|
CONSTANT_info |
set(int index,
CONSTANT_info constant)
Replaces an existing constant pool entry.
|
int |
size()
Returns the number of CONSTANT_info entries in this collection.
|
writeInClassFormatCONSTANT_info get(int index)
iterator() to iterate only over valid entries
in a transparent fashion.index - constant pool index [must be in [1, size()] range]java.lang.IllegalStateException - if an attempt is made to reference
an invalid slot indexjava.lang.IndexOutOfBoundsException - if an attempt is made to reference
a slot outside of the valid rangeIConstantCollection.IConstantIterator iterator()
int find(int type,
IConstantCollection.IConstantComparator comparator)
type - type of constants to filter by [not validated]comparator - [may not be null]java.lang.IllegalArgumentException - if 'comparator' is nullint findCONSTANT_Utf8(java.lang.String value)
value - string value on which to match [may not be null]java.lang.IllegalArgumentException - if 'value' is nullint size()
java.lang.Object clone()
void accept(IClassDefVisitor visitor, java.lang.Object ctx)
int add(CONSTANT_info constant)
constant - new constant [may not be null; input unchecked]CONSTANT_info set(int index, CONSTANT_info constant)
index - constant pool index [must be in [1, size()] range]constant - new entry to set [may not be null; input unchecked]java.lang.IllegalArgumentException - if the new constant's width is different
from the current entry'sjava.lang.IllegalStateException - if an attempt is made to reference
an invalid slot index [see get(int)]java.lang.IndexOutOfBoundsException - if an attempt is made to reference
a slot outside of the valid range