public class TypeReference
A reference to a type appearing in a class, field or method declaration, or on an instruction. Such a reference designates the part of the class where the referenced type is appearing (e.g. an
'extends', 'implements' or 'throws' clause, a 'new' instruction, a 'catch' clause, a type cast, a
local variable declaration, etc).
public static final int | CAST = 71 The sort of type references that target the type declared in an explicit or implicit cast
instruction. |
public static final int | CLASS_EXTENDS = 16 The sort of type references that target the super class of a class or one of the interfaces it
implements. |
public static final int | The sort of type references that target a type parameter of a generic class. |
public static final int | The sort of type references that target a bound of a type parameter of a generic class. |
public static final int | The sort of type references that target a type parameter of a generic constructor in a
constructor call. |
public static final int | The sort of type references that target the receiver type of a constructor reference. |
public static final int | The sort of type references that target a type parameter of a generic constructor in a
constructor reference. |
public static final int | EXCEPTION_PARAMETER = 66 The sort of type references that target the type of the exception of a 'catch' clause in a
method. |
public static final int | FIELD = 19 The sort of type references that target the type of a field. |
public static final int | INSTANCEOF = 67 The sort of type references that target the type declared in an 'instanceof' instruction. |
public static final int | LOCAL_VARIABLE = 64 The sort of type references that target the type of a local variable in a method. |
public static final int | The sort of type references that target the type of a formal parameter of a method. |
public static final int | The sort of type references that target a type parameter of a generic method in a method call. |
public static final int | METHOD_RECEIVER = 21 The sort of type references that target the receiver type of a method. |
public static final int | METHOD_REFERENCE = 70 The sort of type references that target the receiver type of a method reference. |
public static final int | The sort of type references that target a type parameter of a generic method in a method
reference. |
public static final int | METHOD_RETURN = 20 The sort of type references that target the return type of a method. |
public static final int | The sort of type references that target a type parameter of a generic method. |
public static final int | The sort of type references that target a bound of a type parameter of a generic method. |
public static final int | NEW = 68 The sort of type references that target the type of the object created by a 'new' instruction. |
public static final int | RESOURCE_VARIABLE = 65 The sort of type references that target the type of a resource variable in a method. |
public static final int | THROWS = 23 The sort of type references that target the type of an exception declared in the throws clause
of a method. |
public | TypeReference( Constructs a new TypeReference. |
public int | Returns the index of the exception, in a 'throws' clause of a method, whose type is referenced
by this type reference. |
public int | Returns the index of the formal parameter whose type is referenced by this type reference. |
public int | getSort() Returns the sort of this type reference. |
public int | Returns the index of the "super type" of a class that is referenced by this type reference. |
public int | Returns the index of the try catch block (using the order in which they are visited with
visitTryCatchBlock), whose 'catch' type is referenced by this type reference. |
public int | Returns the index of the type argument referenced by this type reference. |
public int | Returns the index of the type parameter bound, within the type parameter getTypeParameterIndex(), referenced by this type reference. |
public int | Returns the index of the type parameter referenced by this type reference. |
public int | getValue() Returns the int encoded value of this type reference, suitable for use in visit methods related
to type annotations, like visitTypeAnnotation. |
public static TypeReference | newExceptionReference( Returns a reference to the type of an exception, in a 'throws' clause of a method. |
public static TypeReference | newFormalParameterReference( Returns a reference to the type of a formal parameter of a method. |
public static TypeReference | newSuperTypeReference( Returns a reference to the super class or to an interface of the 'implements' clause of a
class. |
public static TypeReference | newTryCatchReference( Returns a reference to the type of the exception declared in a 'catch' clause of a method. |
public static TypeReference | newTypeArgumentReference( Returns a reference to the type of a type argument in a constructor or method call or
reference. |
public static TypeReference | newTypeParameterBoundReference( Returns a reference to a type parameter bound of a generic class or method. |
public static TypeReference | newTypeParameterReference( Returns a reference to a type parameter of a generic class or method. |
public static TypeReference | newTypeReference( Returns a type reference of the given sort. |
The sort of type references that target the type declared in an explicit or implicit cast
instruction. See getSort().
The sort of type references that target the super class of a class or one of the interfaces it
implements. See getSort().
The sort of type references that target a type parameter of a generic class. See getSort().
The sort of type references that target a bound of a type parameter of a generic class. See
getSort().
The sort of type references that target a type parameter of a generic constructor in a
constructor call. See getSort().
The sort of type references that target the receiver type of a constructor reference. See
getSort().
The sort of type references that target a type parameter of a generic constructor in a
constructor reference. See getSort().
The sort of type references that target the type of the exception of a 'catch' clause in a
method. See getSort().
The sort of type references that target the type of a field. See getSort().
The sort of type references that target the type declared in an 'instanceof' instruction. See
getSort().
The sort of type references that target the type of a local variable in a method. See getSort().
The sort of type references that target the type of a formal parameter of a method. See getSort().
The sort of type references that target a type parameter of a generic method in a method call. See getSort().
The sort of type references that target the receiver type of a method. See getSort().
The sort of type references that target the receiver type of a method reference. See getSort().
The sort of type references that target a type parameter of a generic method in a method
reference. See getSort().
The sort of type references that target the return type of a method. See getSort().
The sort of type references that target a type parameter of a generic method. See getSort().
The sort of type references that target a bound of a type parameter of a generic method. See
getSort().
The sort of type references that target the type of the object created by a 'new' instruction. See getSort().
The sort of type references that target the type of a resource variable in a method. See getSort().
Constructs a new TypeReference.
typeRefthe int encoded value of the type reference, as received in a visit method
related to type annotations, such as ClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean) .
Returns the index of the exception, in a 'throws' clause of a method, whose type is referenced
by this type reference. This method must only be used for type references whose sort is THROWS.
the index of an exception in the 'throws' clause of a method.
Returns the index of the formal parameter whose type is referenced by this type reference. This
method must only be used for type references whose sort is METHOD_FORMAL_PARAMETER.
a formal parameter index.
Returns the sort of this type reference.
one of CLASS_TYPE_PARAMETER, METHOD_TYPE_PARAMETER, CLASS_EXTENDS, CLASS_TYPE_PARAMETER_BOUND, METHOD_TYPE_PARAMETER_BOUND,
FIELD, METHOD_RETURN, METHOD_RECEIVER, METHOD_FORMAL_PARAMETER, THROWS, LOCAL_VARIABLE, RESOURCE_VARIABLE, EXCEPTION_PARAMETER, INSTANCEOF, NEW,
CONSTRUCTOR_REFERENCE, METHOD_REFERENCE, CAST, CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, METHOD_INVOCATION_TYPE_ARGUMENT, CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, or METHOD_REFERENCE_TYPE_ARGUMENT.
Returns the index of the "super type" of a class that is referenced by this type reference. This method must only be used for type references whose sort is CLASS_EXTENDS.
the index of an interface in the 'implements' clause of a class, or -1 if this type
reference references the type of the super class.
Returns the index of the try catch block (using the order in which they are visited with
visitTryCatchBlock), whose 'catch' type is referenced by this type reference. This method must
only be used for type references whose sort is EXCEPTION_PARAMETER .
the index of an exception in the 'throws' clause of a method.
Returns the index of the type argument referenced by this type reference. This method must only
be used for type references whose sort is CAST, CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, METHOD_INVOCATION_TYPE_ARGUMENT, CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, or METHOD_REFERENCE_TYPE_ARGUMENT.
a type parameter index.
Returns the index of the type parameter bound, within the type parameter getTypeParameterIndex(), referenced by this type reference. This method must only be used for
type references whose sort is CLASS_TYPE_PARAMETER_BOUND or METHOD_TYPE_PARAMETER_BOUND.
a type parameter bound index.
Returns the index of the type parameter referenced by this type reference. This method must
only be used for type references whose sort is CLASS_TYPE_PARAMETER, METHOD_TYPE_PARAMETER, CLASS_TYPE_PARAMETER_BOUND or METHOD_TYPE_PARAMETER_BOUND.
a type parameter index.
Returns the int encoded value of this type reference, suitable for use in visit methods related
to type annotations, like visitTypeAnnotation.
the int encoded value of this type reference.
Returns a reference to the type of an exception, in a 'throws' clause of a method.
exceptionIndexthe index of an exception in a 'throws' clause of a method.
a reference to the type of the given exception.
Returns a reference to the type of a formal parameter of a method.
paramIndexthe formal parameter index.
a reference to the type of the given method formal parameter.
Returns a reference to the super class or to an interface of the 'implements' clause of a
class.
itfIndexthe index of an interface in the 'implements' clause of a class, or -1 to
reference the super class of the class.
a reference to the given super type of a class.
Returns a reference to the type of the exception declared in a 'catch' clause of a method.
tryCatchBlockIndexthe index of a try catch block (using the order in which they are
visited with visitTryCatchBlock).
a reference to the type of the given exception.
Returns a reference to the type of a type argument in a constructor or method call or
reference.
sortone of CAST, CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT, METHOD_INVOCATION_TYPE_ARGUMENT, CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, or METHOD_REFERENCE_TYPE_ARGUMENT.
argIndexthe type argument index.
a reference to the type of the given type argument.
public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex)
Returns a reference to a type parameter bound of a generic class or method.
sortone of CLASS_TYPE_PARAMETER or METHOD_TYPE_PARAMETER.
paramIndexthe type parameter index.
boundIndexthe type bound index within the above type parameters.
a reference to the given generic class or method type parameter bound.
Returns a reference to a type parameter of a generic class or method.
sortone of CLASS_TYPE_PARAMETER or METHOD_TYPE_PARAMETER.
paramIndexthe type parameter index.
a reference to the given generic class or method type parameter.
Returns a type reference of the given sort.
sortone of FIELD, METHOD_RETURN, METHOD_RECEIVER, LOCAL_VARIABLE, RESOURCE_VARIABLE, INSTANCEOF, NEW, CONSTRUCTOR_REFERENCE, or METHOD_REFERENCE.
a type reference of the given sort.