类 TypeReference
java.lang.Object
org.babyfish.jimmer.impl.asm.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).
-
字段概要
字段修饰符和类型字段说明static final intThe sort of type references that target the type declared in an explicit or implicit cast instruction.static final intThe sort of type references that target the super class of a class or one of the interfaces it implements.static final intThe sort of type references that target a type parameter of a generic class.static final intThe sort of type references that target a bound of a type parameter of a generic class.static final intThe sort of type references that target a type parameter of a generic constructor in a constructor call.static final intThe sort of type references that target the receiver type of a constructor reference.static final intThe sort of type references that target a type parameter of a generic constructor in a constructor reference.static final intThe sort of type references that target the type of the exception of a 'catch' clause in a method.static final intThe sort of type references that target the type of a field.static final intThe sort of type references that target the type declared in an 'instanceof' instruction.static final intThe sort of type references that target the type of a local variable in a method.static final intThe sort of type references that target the type of a formal parameter of a method.static final intThe sort of type references that target a type parameter of a generic method in a method call.static final intThe sort of type references that target the receiver type of a method.static final intThe sort of type references that target the receiver type of a method reference.static final intThe sort of type references that target a type parameter of a generic method in a method reference.static final intThe sort of type references that target the return type of a method.static final intThe sort of type references that target a type parameter of a generic method.static final intThe sort of type references that target a bound of a type parameter of a generic method.static final intThe sort of type references that target the type of the object created by a 'new' instruction.static final intThe sort of type references that target the type of a resource variable in a method.static final intThe sort of type references that target the type of an exception declared in the throws clause of a method. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明intReturns the index of the exception, in a 'throws' clause of a method, whose type is referenced by this type reference.intReturns the index of the formal parameter whose type is referenced by this type reference.intgetSort()Returns the sort of this type reference.intReturns the index of the "super type" of a class that is referenced by this type reference.intReturns 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.intReturns the index of the type argument referenced by this type reference.intReturns the index of the type parameter bound, within the type parametergetTypeParameterIndex(), referenced by this type reference.intReturns the index of the type parameter referenced by this type reference.intgetValue()Returns the int encoded value of this type reference, suitable for use in visit methods related to type annotations, like visitTypeAnnotation.static TypeReferencenewExceptionReference(int exceptionIndex) Returns a reference to the type of an exception, in a 'throws' clause of a method.static TypeReferencenewFormalParameterReference(int paramIndex) Returns a reference to the type of a formal parameter of a method.static TypeReferencenewSuperTypeReference(int itfIndex) Returns a reference to the super class or to an interface of the 'implements' clause of a class.static TypeReferencenewTryCatchReference(int tryCatchBlockIndex) Returns a reference to the type of the exception declared in a 'catch' clause of a method.static TypeReferencenewTypeArgumentReference(int sort, int argIndex) Returns a reference to the type of a type argument in a constructor or method call or reference.static TypeReferencenewTypeParameterBoundReference(int sort, int paramIndex, int boundIndex) Returns a reference to a type parameter bound of a generic class or method.static TypeReferencenewTypeParameterReference(int sort, int paramIndex) Returns a reference to a type parameter of a generic class or method.static TypeReferencenewTypeReference(int sort) Returns a type reference of the given sort.
-
字段详细资料
-
CLASS_TYPE_PARAMETER
public static final int CLASS_TYPE_PARAMETERThe sort of type references that target a type parameter of a generic class. SeegetSort().- 另请参阅:
-
METHOD_TYPE_PARAMETER
public static final int METHOD_TYPE_PARAMETERThe sort of type references that target a type parameter of a generic method. SeegetSort().- 另请参阅:
-
CLASS_EXTENDS
public static final int CLASS_EXTENDSThe sort of type references that target the super class of a class or one of the interfaces it implements. SeegetSort().- 另请参阅:
-
CLASS_TYPE_PARAMETER_BOUND
public static final int CLASS_TYPE_PARAMETER_BOUNDThe sort of type references that target a bound of a type parameter of a generic class. SeegetSort().- 另请参阅:
-
METHOD_TYPE_PARAMETER_BOUND
public static final int METHOD_TYPE_PARAMETER_BOUNDThe sort of type references that target a bound of a type parameter of a generic method. SeegetSort().- 另请参阅:
-
FIELD
public static final int FIELDThe sort of type references that target the type of a field. SeegetSort().- 另请参阅:
-
METHOD_RETURN
public static final int METHOD_RETURNThe sort of type references that target the return type of a method. SeegetSort().- 另请参阅:
-
METHOD_RECEIVER
public static final int METHOD_RECEIVERThe sort of type references that target the receiver type of a method. SeegetSort().- 另请参阅:
-
METHOD_FORMAL_PARAMETER
public static final int METHOD_FORMAL_PARAMETERThe sort of type references that target the type of a formal parameter of a method. SeegetSort().- 另请参阅:
-
THROWS
public static final int THROWSThe sort of type references that target the type of an exception declared in the throws clause of a method. SeegetSort().- 另请参阅:
-
LOCAL_VARIABLE
public static final int LOCAL_VARIABLEThe sort of type references that target the type of a local variable in a method. SeegetSort().- 另请参阅:
-
RESOURCE_VARIABLE
public static final int RESOURCE_VARIABLEThe sort of type references that target the type of a resource variable in a method. SeegetSort().- 另请参阅:
-
EXCEPTION_PARAMETER
public static final int EXCEPTION_PARAMETERThe sort of type references that target the type of the exception of a 'catch' clause in a method. SeegetSort().- 另请参阅:
-
INSTANCEOF
public static final int INSTANCEOFThe sort of type references that target the type declared in an 'instanceof' instruction. SeegetSort().- 另请参阅:
-
NEW
public static final int NEWThe sort of type references that target the type of the object created by a 'new' instruction. SeegetSort().- 另请参阅:
-
CONSTRUCTOR_REFERENCE
public static final int CONSTRUCTOR_REFERENCEThe sort of type references that target the receiver type of a constructor reference. SeegetSort().- 另请参阅:
-
METHOD_REFERENCE
public static final int METHOD_REFERENCEThe sort of type references that target the receiver type of a method reference. SeegetSort().- 另请参阅:
-
CAST
public static final int CASTThe sort of type references that target the type declared in an explicit or implicit cast instruction. SeegetSort().- 另请参阅:
-
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
public static final int CONSTRUCTOR_INVOCATION_TYPE_ARGUMENTThe sort of type references that target a type parameter of a generic constructor in a constructor call. SeegetSort().- 另请参阅:
-
METHOD_INVOCATION_TYPE_ARGUMENT
public static final int METHOD_INVOCATION_TYPE_ARGUMENTThe sort of type references that target a type parameter of a generic method in a method call. SeegetSort().- 另请参阅:
-
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
public static final int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENTThe sort of type references that target a type parameter of a generic constructor in a constructor reference. SeegetSort().- 另请参阅:
-
METHOD_REFERENCE_TYPE_ARGUMENT
public static final int METHOD_REFERENCE_TYPE_ARGUMENTThe sort of type references that target a type parameter of a generic method in a method reference. SeegetSort().- 另请参阅:
-
-
构造器详细资料
-
TypeReference
public TypeReference(int typeRef) Constructs a new TypeReference.- 参数:
typeRef- the int encoded value of the type reference, as received in a visit method related to type annotations, such asClassVisitor.visitTypeAnnotation(int, org.babyfish.jimmer.impl.asm.TypePath, java.lang.String, boolean).
-
-
方法详细资料
-
newTypeReference
Returns a type reference of the given sort.- 参数:
sort- one ofFIELD,METHOD_RETURN,METHOD_RECEIVER,LOCAL_VARIABLE,RESOURCE_VARIABLE,INSTANCEOF,NEW,CONSTRUCTOR_REFERENCE, orMETHOD_REFERENCE.- 返回:
- a type reference of the given sort.
-
newTypeParameterReference
Returns a reference to a type parameter of a generic class or method.- 参数:
sort- one ofCLASS_TYPE_PARAMETERorMETHOD_TYPE_PARAMETER.paramIndex- the type parameter index.- 返回:
- a reference to the given generic class or method type parameter.
-
newTypeParameterBoundReference
public static TypeReference newTypeParameterBoundReference(int sort, int paramIndex, int boundIndex) Returns a reference to a type parameter bound of a generic class or method.- 参数:
sort- one ofCLASS_TYPE_PARAMETERorMETHOD_TYPE_PARAMETER.paramIndex- the type parameter index.boundIndex- the type bound index within the above type parameters.- 返回:
- a reference to the given generic class or method type parameter bound.
-
newSuperTypeReference
Returns a reference to the super class or to an interface of the 'implements' clause of a class.- 参数:
itfIndex- the 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.
-
newFormalParameterReference
Returns a reference to the type of a formal parameter of a method.- 参数:
paramIndex- the formal parameter index.- 返回:
- a reference to the type of the given method formal parameter.
-
newExceptionReference
Returns a reference to the type of an exception, in a 'throws' clause of a method.- 参数:
exceptionIndex- the index of an exception in a 'throws' clause of a method.- 返回:
- a reference to the type of the given exception.
-
newTryCatchReference
Returns a reference to the type of the exception declared in a 'catch' clause of a method.- 参数:
tryCatchBlockIndex- the 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.
-
newTypeArgumentReference
Returns a reference to the type of a type argument in a constructor or method call or reference.- 参数:
sort- one ofCAST,CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,METHOD_INVOCATION_TYPE_ARGUMENT,CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, orMETHOD_REFERENCE_TYPE_ARGUMENT.argIndex- the type argument index.- 返回:
- a reference to the type of the given type argument.
-
getSort
public int getSort()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, orMETHOD_REFERENCE_TYPE_ARGUMENT.
-
getTypeParameterIndex
public int getTypeParameterIndex()Returns the index of the type parameter referenced by this type reference. This method must only be used for type references whose sort isCLASS_TYPE_PARAMETER,METHOD_TYPE_PARAMETER,CLASS_TYPE_PARAMETER_BOUNDorMETHOD_TYPE_PARAMETER_BOUND.- 返回:
- a type parameter index.
-
getTypeParameterBoundIndex
public int getTypeParameterBoundIndex()Returns the index of the type parameter bound, within the type parametergetTypeParameterIndex(), referenced by this type reference. This method must only be used for type references whose sort isCLASS_TYPE_PARAMETER_BOUNDorMETHOD_TYPE_PARAMETER_BOUND.- 返回:
- a type parameter bound index.
-
getSuperTypeIndex
public int getSuperTypeIndex()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 isCLASS_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.
-
getFormalParameterIndex
public int getFormalParameterIndex()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 isMETHOD_FORMAL_PARAMETER.- 返回:
- a formal parameter index.
-
getExceptionIndex
public int getExceptionIndex()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 isTHROWS.- 返回:
- the index of an exception in the 'throws' clause of a method.
-
getTryCatchBlockIndex
public int getTryCatchBlockIndex()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 isEXCEPTION_PARAMETER.- 返回:
- the index of an exception in the 'throws' clause of a method.
-
getTypeArgumentIndex
public int getTypeArgumentIndex()Returns the index of the type argument referenced by this type reference. This method must only be used for type references whose sort isCAST,CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT,METHOD_INVOCATION_TYPE_ARGUMENT,CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT, orMETHOD_REFERENCE_TYPE_ARGUMENT.- 返回:
- a type parameter index.
-
getValue
public int getValue()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.
-