public final class TypePath
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ARRAY_ELEMENT
A type path step that steps into the element type of an array type.
|
static int |
INNER_TYPE
A type path step that steps into the nested type of a class type.
|
static int |
TYPE_ARGUMENT
A type path step that steps into a type argument of a generic type.
|
private byte[] |
typePathContainer
The byte array where the 'type_path' structure - as defined in the Java Virtual Machine
Specification (JVMS) - corresponding to this TypePath is stored.
|
private int |
typePathOffset
The offset of the first byte of the type_path JVMS structure in
typePathContainer . |
static int |
WILDCARD_BOUND
A type path step that steps into the bound of a wildcard type.
|
Constructor and Description |
---|
TypePath(byte[] typePathContainer,
int typePathOffset)
Constructs a new TypePath.
|
Modifier and Type | Method and Description |
---|---|
static TypePath |
fromString(java.lang.String typePath)
Converts a type path in string form, in the format used by
toString() , into a TypePath
object. |
int |
getLength()
Returns the length of this path, i.e.
|
int |
getStep(int index)
Returns the value of the given step of this path.
|
int |
getStepArgument(int index)
Returns the index of the type argument that the given step is stepping into.
|
(package private) static void |
put(TypePath typePath,
ByteVector output)
Puts the type_path JVMS structure corresponding to the given TypePath into the given
ByteVector.
|
java.lang.String |
toString()
Returns a string representation of this type path.
|
public static final int ARRAY_ELEMENT
getStep(int)
.public static final int INNER_TYPE
getStep(int)
.public static final int WILDCARD_BOUND
getStep(int)
.public static final int TYPE_ARGUMENT
getStep(int)
.private final byte[] typePathContainer
typePathOffset
.private final int typePathOffset
typePathContainer
.TypePath(byte[] typePathContainer, int typePathOffset)
typePathContainer
- a byte array containing a type_path JVMS structure.typePathOffset
- the offset of the first byte of the type_path structure in
typePathContainer.public int getLength()
public int getStep(int index)
index
- an index between 0 and getLength()
, exclusive.ARRAY_ELEMENT
, INNER_TYPE
, WILDCARD_BOUND
, or TYPE_ARGUMENT
.public int getStepArgument(int index)
TYPE_ARGUMENT
.index
- an index between 0 and getLength()
, exclusive.public static TypePath fromString(java.lang.String typePath)
toString()
, into a TypePath
object.typePath
- a type path in string form, in the format used by toString()
. May be
null or empty.public java.lang.String toString()
ARRAY_ELEMENT
steps are represented
with '[', INNER_TYPE
steps with '.', WILDCARD_BOUND
steps with '*' and TYPE_ARGUMENT
steps with their type argument index in decimal form followed by ';'.toString
in class java.lang.Object
static void put(TypePath typePath, ByteVector output)
typePath
- a TypePath instance, or null for empty paths.output
- where the type path must be put.