Package org.eclipse.sisu.space.asm
Class TypePath
java.lang.Object
org.eclipse.sisu.space.asm.TypePath
The path to a type argument, wildcard bound, array element type, or static
inner type within an enclosing type.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
A type path step that steps into the element type of an array type.(package private) byte[]
The byte array where the path is stored, in Java class file format.static final int
A type path step that steps into the nested type of a class type.(package private) int
The offset of the first byte of the type path in 'b'.static final int
A type path step that steps into a type argument of a generic type.static final int
A type path step that steps into the bound of a wildcard type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TypePath
fromString
(String typePath) Converts a type path in string form, in the format used bytoString()
, into a TypePath object.int
Returns the length of this path.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.toString()
Returns a string representation of this type path.
-
Field Details
-
ARRAY_ELEMENT
public static final int ARRAY_ELEMENTA type path step that steps into the element type of an array type. SeegetStep
.- See Also:
-
INNER_TYPE
public static final int INNER_TYPEA type path step that steps into the nested type of a class type. SeegetStep
.- See Also:
-
WILDCARD_BOUND
public static final int WILDCARD_BOUNDA type path step that steps into the bound of a wildcard type. SeegetStep
.- See Also:
-
TYPE_ARGUMENT
public static final int TYPE_ARGUMENTA type path step that steps into a type argument of a generic type. SeegetStep
.- See Also:
-
b
byte[] bThe byte array where the path is stored, in Java class file format. -
offset
int offsetThe offset of the first byte of the type path in 'b'.
-
-
Constructor Details
-
TypePath
TypePath(byte[] b, int offset) Creates a new type path.- Parameters:
b
- the byte array containing the type path in Java class file format.offset
- the offset of the first byte of the type path in 'b'.
-
-
Method Details
-
getLength
public int getLength()Returns the length of this path.- Returns:
- the length of this path.
-
getStep
public int getStep(int index) Returns the value of the given step of this path.- Parameters:
index
- an index between 0 andgetLength()
, exclusive.- Returns:
ARRAY_ELEMENT
,INNER_TYPE
,WILDCARD_BOUND
, orTYPE_ARGUMENT
.
-
getStepArgument
public int getStepArgument(int index) Returns the index of the type argument that the given step is stepping into. This method should only be used for steps whose value isTYPE_ARGUMENT
.- Parameters:
index
- an index between 0 andgetLength()
, exclusive.- Returns:
- the index of the type argument that the given step is stepping into.
-
fromString
Converts a type path in string form, in the format used bytoString()
, into a TypePath object.- Parameters:
typePath
- a type path in string form, in the format used bytoString()
. May be null or empty.- Returns:
- the corresponding TypePath object, or null if the path is empty.
-
toString
Returns a string representation of this type path.ARRAY_ELEMENT
steps are represented with '[',INNER_TYPE
steps with '.',WILDCARD_BOUND
steps with '*' andTYPE_ARGUMENT
steps with their type argument index in decimal form.
-