Top Description Fields Constructors Methods
net.bytebuddy.jar.asm

public final Class TypePath

extends Object
Class Inheritance

The path to a type argument, wildcard bound, array element type, or static inner type within an enclosing type.
Author
Eric Bruneton

Field Summary

Modifier and TypeField and Description
public static final int
ARRAY_ELEMENT

A type path step that steps into the element type of an array type.

public static final int
INNER_TYPE

A type path step that steps into the nested type of a class type.

public static final int
TYPE_ARGUMENT

A type path step that steps into a type argument of a generic type.

private final 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 final int
typePathOffset

The offset of the first byte of the type_path JVMS structure in typePathContainer.

public static final int
WILDCARD_BOUND

A type path step that steps into the bound of a wildcard type.

Constructor Summary

AccessConstructor and Description
pack-priv
TypePath(final byte[]
a byte array containing a type_path JVMS structure.
typePathContainer
,
final int
the offset of the first byte of the type_path structure in typePathContainer.
typePathOffset
)

Constructs a new TypePath.

Method Summary

Modifier and TypeMethod and Description
public static TypePath

Returns:

the corresponding TypePath object, or null if the path is empty.
fromString
(final String
a type path in string form, in the format used by toString(). May be null or empty.
typePath
)

Converts a type path in string form, in the format used by toString(), into a TypePath object.

public int

Returns:

the length of this path.
getLength
()

Returns the length of this path, i.e. its number of steps.

public int
getStep(final int
an index between 0 and getLength(), exclusive.
index
)

Returns the value of the given step of this path.

public int

Returns:

the index of the type argument that the given step is stepping into.
getStepArgument
(final int
an index between 0 and getLength(), exclusive.
index
)

Returns the index of the type argument that the given step is stepping into.

pack-priv static void
put(final TypePath
a TypePath instance, or null for empty paths.
typePath
,
final ByteVector
where the type path must be put.
output
)

Puts the type_path JVMS structure corresponding to the given TypePath into the given ByteVector.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of this type path.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ARRAY_ELEMENTback to summary
public static final int ARRAY_ELEMENT

A type path step that steps into the element type of an array type. See getStep.

INNER_TYPEback to summary
public static final int INNER_TYPE

A type path step that steps into the nested type of a class type. See getStep.

TYPE_ARGUMENTback to summary
public static final int TYPE_ARGUMENT

A type path step that steps into a type argument of a generic type. See getStep.

typePathContainerback to summary
private final 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. The first byte of the structure in this array is given by typePathOffset.

See Also
JVMS 4.7.20.2
typePathOffsetback to summary
private final int typePathOffset

The offset of the first byte of the type_path JVMS structure in typePathContainer.

WILDCARD_BOUNDback to summary
public static final int WILDCARD_BOUND

A type path step that steps into the bound of a wildcard type. See getStep.

Constructor Detail

TypePathback to summary
pack-priv TypePath(final byte[] typePathContainer, final int typePathOffset)

Constructs a new TypePath.

Parameters
typePathContainer:byte[]

a byte array containing a type_path JVMS structure.

typePathOffset:int

the offset of the first byte of the type_path structure in typePathContainer.

Method Detail

fromStringback to summary
public static TypePath fromString(final String typePath)

Converts a type path in string form, in the format used by toString(), into a TypePath object.

Parameters
typePath:String

a type path in string form, in the format used by toString(). May be null or empty.

Returns:TypePath

the corresponding TypePath object, or null if the path is empty.

getLengthback to summary
public int getLength()

Returns the length of this path, i.e. its number of steps.

Returns:int

the length of this path.

getStepback to summary
public int getStep(final int index)

Returns the value of the given step of this path.

Parameters
index:int

an index between 0 and getLength(), exclusive.

Returns:int

one of ARRAY_ELEMENT, INNER_TYPE, WILDCARD_BOUND, or TYPE_ARGUMENT.

getStepArgumentback to summary
public int getStepArgument(final 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 is TYPE_ARGUMENT.

Parameters
index:int

an index between 0 and getLength(), exclusive.

Returns:int

the index of the type argument that the given step is stepping into.

putback to summary
pack-priv static void put(final TypePath typePath, final ByteVector output)

Puts the type_path JVMS structure corresponding to the given TypePath into the given ByteVector.

Parameters
typePath:TypePath

a TypePath instance, or null for empty paths.

output:ByteVector

where the type path must be put.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this type path. 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 ';'.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override