- All Known Subinterfaces:
ClassReader,ConstantPoolBuilder
- All Known Implementing Classes:
ClassReaderImpl,SplitConstantPool,TemporaryConstantPool
public sealed interface ConstantPool
extends Iterable<PoolEntry>
permits ClassReader, ConstantPoolBuilder
Provides read access to the constant pool and bootstrap method table of a
classfile.
- Since:
- 22
- Jvms:
- 4.4 The Constant Pool
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of entries in the bootstrap method table.bootstrapMethodEntry(int index) Returns theBootstrapMethodEntryat the specified index within the bootstrap method table.entryByIndex(int index) Returns the entry at the specified index.iterator()Returns an iterator over pool entries.intsize()Returns the size of the constant pool.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
entryByIndex
Returns the entry at the specified index.- Parameters:
index- the index within the pool of the desired entry- Returns:
- the entry at the specified index
- Throws:
ConstantPoolException- if the index is out of range of the constant pool, or is considered unusable
-
size
int size()Returns the size of the constant pool.- Returns:
- the size of the constant pool
-
iterator
Returns an iterator over pool entries. -
bootstrapMethodEntry
Returns theBootstrapMethodEntryat the specified index within the bootstrap method table.- Parameters:
index- the index within the bootstrap method table of the desired entry- Returns:
- the
BootstrapMethodEntryat the specified index within the bootstrap method table - Throws:
ConstantPoolException- if the index is out of range of the bootstrap methods
-
bootstrapMethodCount
int bootstrapMethodCount()Returns the number of entries in the bootstrap method table.- Returns:
- the number of entries in the bootstrap method table
-