类 Type
java.lang.Object
org.beetl.ow2.asm.Type
A Java field or method type. This class can be used to make it easier to
manipulate type and method descriptors.
- 作者:
- Eric Bruneton, Chris Nokleberg
-
字段概要
字段修饰符和类型字段说明static final intThe sort of array reference types.static final intThe sort of the boolean type.static final TypeThe boolean type.static final intThe sort of the byte type.static final TypeThe byte type.static final intThe sort of the char type.static final TypeThe char type.static final intThe sort of the double type.static final TypeThe double type.static final intThe sort of the float type.static final TypeThe float type.static final intThe sort of the int type.static final TypeThe int type.static final intThe sort of the long type.static final TypeThe long type.static final intThe sort of method types.static final intThe sort of object reference types.static final intThe sort of the short type.static final TypeThe short type.static final intThe sort of the void type.static final TypeThe void type. -
方法概要
修饰符和类型方法说明booleanTests if the given object is equal to this type.intReturns the size of the arguments and of the return value of methods of this type.static intComputes the size of the arguments and of the return value of a method.Type[]Returns the argument types of methods of this type.static Type[]getArgumentTypes(Method method) Returns the Java types corresponding to the argument types of the given method.static Type[]getArgumentTypes(String methodDescriptor) Returns the Java types corresponding to the argument types of the given method descriptor.Returns the binary className of the class corresponding to this type.static StringReturns the descriptor corresponding to the given constructor.Returns the descriptor corresponding to this Java type.static StringgetDescriptor(Class<?> c) Returns the descriptor corresponding to the given Java type.intReturns the number of dimensions of this array type.Returns the type of the elements of this array type.Returns the internal className of the class corresponding to this object or array type.static StringgetInternalName(Class<?> c) Returns the internal className of the given class.static StringReturns the descriptor corresponding to the given method.static StringgetMethodDescriptor(Type returnType, Type... argumentTypes) Returns the descriptor corresponding to the given argument and return types.static TypegetMethodType(String methodDescriptor) Returns the Java type corresponding to the given method descriptor.static TypegetMethodType(Type returnType, Type... argumentTypes) Returns the Java method type corresponding to the given argument and return types.static TypegetObjectType(String internalName) Returns the Java type corresponding to the given internal className.intgetOpcode(int opcode) Returns a JVM instruction opcode adapted to this Java type.Returns the return type of methods of this type.static TypegetReturnType(Method method) Returns the Java type corresponding to the return type of the given method.static TypegetReturnType(String methodDescriptor) Returns the Java type corresponding to the return type of the given method descriptor.intgetSize()Returns the size of values of this type.intgetSort()Returns the sort of this Java type.static TypeReturns the Java type corresponding to the given class.static TypegetType(Constructor<?> c) Returns the Java method type corresponding to the given constructor.static TypeReturns the Java method type corresponding to the given method.static TypeReturns the Java type corresponding to the given type descriptor.inthashCode()Returns a hash code value for this type.toString()Returns a string representation of this type.
-
字段详细资料
-
VOID
public static final int VOIDThe sort of the void type. SeegetSort.- 另请参阅:
-
BOOLEAN
public static final int BOOLEANThe sort of the boolean type. SeegetSort.- 另请参阅:
-
CHAR
public static final int CHARThe sort of the char type. SeegetSort.- 另请参阅:
-
BYTE
public static final int BYTEThe sort of the byte type. SeegetSort.- 另请参阅:
-
SHORT
public static final int SHORTThe sort of the short type. SeegetSort.- 另请参阅:
-
INT
public static final int INTThe sort of the int type. SeegetSort.- 另请参阅:
-
FLOAT
public static final int FLOATThe sort of the float type. SeegetSort.- 另请参阅:
-
LONG
public static final int LONGThe sort of the long type. SeegetSort.- 另请参阅:
-
DOUBLE
public static final int DOUBLEThe sort of the double type. SeegetSort.- 另请参阅:
-
ARRAY
public static final int ARRAYThe sort of array reference types. SeegetSort.- 另请参阅:
-
OBJECT
public static final int OBJECTThe sort of object reference types. SeegetSort.- 另请参阅:
-
METHOD
public static final int METHODThe sort of method types. SeegetSort.- 另请参阅:
-
VOID_TYPE
The void type. -
BOOLEAN_TYPE
The boolean type. -
CHAR_TYPE
The char type. -
BYTE_TYPE
The byte type. -
SHORT_TYPE
The short type. -
INT_TYPE
The int type. -
FLOAT_TYPE
The float type. -
LONG_TYPE
The long type. -
DOUBLE_TYPE
The double type.
-
-
方法详细资料
-
getType
Returns the Java type corresponding to the given type descriptor.- 参数:
typeDescriptor- a field or method type descriptor.- 返回:
- the Java type corresponding to the given type descriptor.
-
getObjectType
Returns the Java type corresponding to the given internal className.- 参数:
internalName- an internal className.- 返回:
- the Java type corresponding to the given internal className.
-
getMethodType
Returns the Java type corresponding to the given method descriptor. Equivalent toType.getType(methodDescriptor).- 参数:
methodDescriptor- a method descriptor.- 返回:
- the Java type corresponding to the given method descriptor.
-
getMethodType
Returns the Java method type corresponding to the given argument and return types.- 参数:
returnType- the return type of the method.argumentTypes- the argument types of the method.- 返回:
- the Java type corresponding to the given argument and return types.
-
getType
Returns the Java type corresponding to the given class.- 参数:
c- a class.- 返回:
- the Java type corresponding to the given class.
-
getType
Returns the Java method type corresponding to the given constructor.- 参数:
c- aConstructorobject.- 返回:
- the Java method type corresponding to the given constructor.
-
getType
Returns the Java method type corresponding to the given method.- 参数:
m- aMethodobject.- 返回:
- the Java method type corresponding to the given method.
-
getArgumentTypes
Returns the Java types corresponding to the argument types of the given method descriptor.- 参数:
methodDescriptor- a method descriptor.- 返回:
- the Java types corresponding to the argument types of the given method descriptor.
-
getArgumentTypes
Returns the Java types corresponding to the argument types of the given method.- 参数:
method- a method.- 返回:
- the Java types corresponding to the argument types of the given method.
-
getReturnType
Returns the Java type corresponding to the return type of the given method descriptor.- 参数:
methodDescriptor- a method descriptor.- 返回:
- the Java type corresponding to the return type of the given method descriptor.
-
getReturnType
Returns the Java type corresponding to the return type of the given method.- 参数:
method- a method.- 返回:
- the Java type corresponding to the return type of the given method.
-
getArgumentsAndReturnSizes
Computes the size of the arguments and of the return value of a method.- 参数:
desc- the descriptor of a method.- 返回:
- the size of the arguments of the method (plus one for the implicit this argument), argSize, and the size of its return value, retSize, packed into a single int i = (argSize << 2) | retSize (argSize is therefore equal to i >> 2, and retSize to i & 0x03).
-
getSort
public int getSort()Returns the sort of this Java type. -
getDimensions
public int getDimensions()Returns the number of dimensions of this array type. This method should only be used for an array type.- 返回:
- the number of dimensions of this array type.
-
getElementType
Returns the type of the elements of this array type. This method should only be used for an array type.- 返回:
- Returns the type of the elements of this array type.
-
getClassName
Returns the binary className of the class corresponding to this type. This method must not be used on method types.- 返回:
- the binary className of the class corresponding to this type.
-
getInternalName
Returns the internal className of the class corresponding to this object or array type. The internal className of a class is its fully qualified className (as returned by Class.getName(), where '.' are replaced by '/'. This method should only be used for an object or array type.- 返回:
- the internal className of the class corresponding to this object type.
-
getArgumentTypes
Returns the argument types of methods of this type. This method should only be used for method types.- 返回:
- the argument types of methods of this type.
-
getReturnType
Returns the return type of methods of this type. This method should only be used for method types.- 返回:
- the return type of methods of this type.
-
getArgumentsAndReturnSizes
public int getArgumentsAndReturnSizes()Returns the size of the arguments and of the return value of methods of this type. This method should only be used for method types.- 返回:
- the size of the arguments (plus one for the implicit this argument), argSize, and the size of the return value, retSize, packed into a single int i = (argSize << 2) | retSize (argSize is therefore equal to i >> 2, and retSize to i & 0x03).
-
getDescriptor
Returns the descriptor corresponding to this Java type.- 返回:
- the descriptor corresponding to this Java type.
-
getMethodDescriptor
Returns the descriptor corresponding to the given argument and return types.- 参数:
returnType- the return type of the method.argumentTypes- the argument types of the method.- 返回:
- the descriptor corresponding to the given argument and return types.
-
getInternalName
Returns the internal className of the given class. The internal className of a class is its fully qualified className, as returned by Class.getName(), where '.' are replaced by '/'.- 参数:
c- an object or array class.- 返回:
- the internal className of the given class.
-
getDescriptor
Returns the descriptor corresponding to the given Java type.- 参数:
c- an object class, a primitive class or an array class.- 返回:
- the descriptor corresponding to the given class.
-
getConstructorDescriptor
Returns the descriptor corresponding to the given constructor.- 参数:
c- aConstructorobject.- 返回:
- the descriptor of the given constructor.
-
getMethodDescriptor
Returns the descriptor corresponding to the given method.- 参数:
m- aMethodobject.- 返回:
- the descriptor of the given method.
-
getSize
public int getSize()Returns the size of values of this type. This method must not be used for method types.- 返回:
- the size of values of this type, i.e., 2 for long and double, 0 for void and 1 otherwise.
-
getOpcode
public int getOpcode(int opcode) Returns a JVM instruction opcode adapted to this Java type. This method must not be used for method types.- 参数:
opcode- a JVM instruction opcode. This opcode must be one of ILOAD, ISTORE, IALOAD, IASTORE, IADD, ISUB, IMUL, IDIV, IREM, INEG, ISHL, ISHR, IUSHR, IAND, IOR, IXOR and IRETURN.- 返回:
- an opcode that is similar to the given opcode, but adapted to this Java type. For example, if this type is float and opcode is IRETURN, this method returns FRETURN.
-
equals
Tests if the given object is equal to this type. -
hashCode
public int hashCode()Returns a hash code value for this type. -
toString
Returns a string representation of this type.
-