private abstract static class ClassDump.AbstractBuilder<T> extends java.lang.Object implements ClassDump.ClassContext, ClassDump.MethodContext
Each internal node is a context that can store a mapping between constant pool indices and constant pool items and between bytecode offsets and instructions indices. This can be used to resolve references to such objects. Contexts inherit from their parent, i.e. if a lookup fails in some builder, the lookup continues in the parent, and so on until the root is reached.
Modifier and Type | Field and Description |
---|---|
(package private) java.util.ArrayList<T> |
children
The children of this builder.
|
private java.util.HashMap<java.lang.Integer,java.lang.Object> |
context
The map used to implement the Context interfaces.
|
private static int |
CP_INFO_KEY
Flag used to distinguish CpInfo keys in
context . |
private ClassDump.AbstractBuilder<?> |
parent
The parent node of this node.
|
Constructor and Description |
---|
AbstractBuilder(ClassDump.AbstractBuilder<?> parent) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
build(java.lang.StringBuilder stringBuilder)
Recursively appends the builder's children to the given string.
|
private java.lang.Object |
get(int key)
Returns the value associated with the given key.
|
(package private) ClassDump.CpInfo |
getCpInfo(int cpIndex)
Lookup constant pool items from their index.
|
<C extends ClassDump.CpInfo> |
getCpInfo(int cpIndex,
java.lang.Class<C> cpInfoType) |
int |
getInsnIndex(int bytecodeOffset) |
(package private) void |
putCpInfo(int cpIndex,
ClassDump.CpInfo cpInfo)
Registers the CpInfo for the given constant pool index.
|
(package private) void |
putInsnIndex(int bytecodeOffset,
int instructionIndex)
Registers the instruction index for the given bytecode offset.
|
private static final int CP_INFO_KEY
context
.private final ClassDump.AbstractBuilder<?> parent
final java.util.ArrayList<T> children
private final java.util.HashMap<java.lang.Integer,java.lang.Object> context
AbstractBuilder(ClassDump.AbstractBuilder<?> parent)
ClassDump.CpInfo getCpInfo(int cpIndex)
cpIndex
- a constant pool item index.public <C extends ClassDump.CpInfo> C getCpInfo(int cpIndex, java.lang.Class<C> cpInfoType)
getCpInfo
in interface ClassDump.ClassContext
public int getInsnIndex(int bytecodeOffset)
getInsnIndex
in interface ClassDump.MethodContext
void putCpInfo(int cpIndex, ClassDump.CpInfo cpInfo)
cpIndex
- a constant pool item index.cpInfo
- a constant pool item.void putInsnIndex(int bytecodeOffset, int instructionIndex)
bytecodeOffset
- a bytecode offset.instructionIndex
- the index of a bytecode instruction.void build(java.lang.StringBuilder stringBuilder)
stringBuilder
- a string builder.private java.lang.Object get(int key)
key
- a context key.