org.springframework.asm

## 类 Type

- java.lang.Object
- - org.springframework.asm.Type

-     public class Type
      extends Object

  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 int` | `ARRAY` The sort of array reference types.
    `static int` | `BOOLEAN` The sort of the `boolean` type.
    `static Type` | `BOOLEAN_TYPE` The `boolean` type.
    `static int` | `BYTE` The sort of the `byte` type.
    `static Type` | `BYTE_TYPE` The `byte` type.
    `static int` | `CHAR` The sort of the `char` type.
    `static Type` | `CHAR_TYPE` The `char` type.
    `static int` | `DOUBLE` The sort of the `double` type.
    `static Type` | `DOUBLE_TYPE` The `double` type.
    `static int` | `FLOAT` The sort of the `float` type.
    `static Type` | `FLOAT_TYPE` The `float` type.
    `static int` | `INT` The sort of the `int` type.
    `static Type` | `INT_TYPE` The `int` type.
    `static int` | `LONG` The sort of the `long` type.
    `static Type` | `LONG_TYPE` The `long` type.
    `static int` | `METHOD` The sort of method types.
    `static int` | `OBJECT` The sort of object reference types.
    `static int` | `SHORT` The sort of the `short` type.
    `static Type` | `SHORT_TYPE` The `short` type.
    `static int` | `VOID` The sort of the `void` type.
    `static Type` | `VOID_TYPE` The `void` type.

  - ### 方法概要

    所有方法 静态方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `equals(Object o)` Tests if the given object is equal to this type.
    `int` | `getArgumentsAndReturnSizes()` Returns the size of the arguments and of the return value of methods of this type.
    `static int` | `getArgumentsAndReturnSizes(String desc)` Computes the size of the arguments and of the return value of a method.
    `Type[]` | `getArgumentTypes()` 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.
    `String` | `getClassName()` Returns the binary name of the class corresponding to this type.
    `static String` | `getConstructorDescriptor(Constructor<?> c)` Returns the descriptor corresponding to the given constructor.
    `String` | `getDescriptor()` Returns the descriptor corresponding to this Java type.
    `static String` | `getDescriptor(Class<?> c)` Returns the descriptor corresponding to the given Java type.
    `int` | `getDimensions()` Returns the number of dimensions of this array type.
    `Type` | `getElementType()` Returns the type of the elements of this array type.
    `String` | `getInternalName()` Returns the internal name of the class corresponding to this object or array type.
    `static String` | `getInternalName(Class<?> c)` Returns the internal name of the given class.
    `static String` | `getMethodDescriptor(Method m)` Returns the descriptor corresponding to the given method.
    `static String` | `getMethodDescriptor(Type returnType, Type... argumentTypes)` Returns the descriptor corresponding to the given argument and return types.
    `static Type` | `getMethodType(String methodDescriptor)` Returns the Java type corresponding to the given method descriptor.
    `static Type` | `getMethodType(Type returnType, Type... argumentTypes)` Returns the Java method type corresponding to the given argument and return types.
    `static Type` | `getObjectType(String internalName)` Returns the Java type corresponding to the given internal name.
    `int` | `getOpcode(int opcode)` Returns a JVM instruction opcode adapted to this Java type.
    `Type` | `getReturnType()` Returns the return type of methods of this type.
    `static Type` | `getReturnType(Method method)` Returns the Java type corresponding to the return type of the given method.
    `static Type` | `getReturnType(String methodDescriptor)` Returns the Java type corresponding to the return type of the given method descriptor.
    `int` | `getSize()` Returns the size of values of this type.
    `int` | `getSort()` Returns the sort of this Java type.
    `static Type` | `getType(Class<?> c)` Returns the Java type corresponding to the given class.
    `static Type` | `getType(Constructor<?> c)` Returns the Java method type corresponding to the given constructor.
    `static Type` | `getType(Method m)` Returns the Java method type corresponding to the given method.
    `static Type` | `getType(String typeDescriptor)` Returns the Java type corresponding to the given type descriptor.
    `int` | `hashCode()` Returns a hash code value for this type.
    `String` | `toString()` Returns a string representation of this type.

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### 字段详细资料

    - #### VOID

          public static final int VOID

      The sort of the `void` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### BOOLEAN

          public static final int BOOLEAN

      The sort of the `boolean` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### CHAR

          public static final int CHAR

      The sort of the `char` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### BYTE

          public static final int BYTE

      The sort of the `byte` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### SHORT

          public static final int SHORT

      The sort of the `short` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### INT

          public static final int INT

      The sort of the `int` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### FLOAT

          public static final int FLOAT

      The sort of the `float` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### LONG

          public static final int LONG

      The sort of the `long` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### DOUBLE

          public static final int DOUBLE

      The sort of the `double` type. See `getSort`.
      另请参阅:
        常量字段值

    - #### ARRAY

          public static final int ARRAY

      The sort of array reference types. See `getSort`.
      另请参阅:
        常量字段值

    - #### OBJECT

          public static final int OBJECT

      The sort of object reference types. See `getSort`.
      另请参阅:
        常量字段值

    - #### METHOD

          public static final int METHOD

      The sort of method types. See `getSort`.
      另请参阅:
        常量字段值

    - #### VOID_TYPE

          public static final Type VOID_TYPE

      The `void` type.

    - #### BOOLEAN_TYPE

          public static final Type BOOLEAN_TYPE

      The `boolean` type.

    - #### CHAR_TYPE

          public static final Type CHAR_TYPE

      The `char` type.

    - #### BYTE_TYPE

          public static final Type BYTE_TYPE

      The `byte` type.

    - #### SHORT_TYPE

          public static final Type SHORT_TYPE

      The `short` type.

    - #### INT_TYPE

          public static final Type INT_TYPE

      The `int` type.

    - #### FLOAT_TYPE

          public static final Type FLOAT_TYPE

      The `float` type.

    - #### LONG_TYPE

          public static final Type LONG_TYPE

      The `long` type.

    - #### DOUBLE_TYPE

          public static final Type DOUBLE_TYPE

      The `double` type.

  - ### 方法详细资料

    - #### getType

          public static Type getType(String typeDescriptor)

      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

          public static Type getObjectType(String internalName)

      Returns the Java type corresponding to the given internal name.
      参数:
        `internalName` - an internal name.
      返回:
        the Java type corresponding to the given internal name.

    - #### getMethodType

          public static Type getMethodType(String methodDescriptor)

      Returns the Java type corresponding to the given method descriptor. Equivalent to `Type.getType(methodDescriptor)`.
      参数:
        `methodDescriptor` - a method descriptor.
      返回:
        the Java type corresponding to the given method descriptor.

    - #### getMethodType

          public static Type getMethodType(Type returnType,
                                           Type... argumentTypes)

      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

          public static Type getType(Class<?> c)

      Returns the Java type corresponding to the given class.
      参数:
        `c` - a class.
      返回:
        the Java type corresponding to the given class.

    - #### getType

          public static Type getType(Constructor<?> c)

      Returns the Java method type corresponding to the given constructor.
      参数:
        `c` - a `Constructor` object.
      返回:
        the Java method type corresponding to the given constructor.

    - #### getType

          public static Type getType(Method m)

      Returns the Java method type corresponding to the given method.
      参数:
        `m` - a `Method` object.
      返回:
        the Java method type corresponding to the given method.

    - #### getArgumentTypes

          public static Type[] getArgumentTypes(String methodDescriptor)

      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

          public static Type[] getArgumentTypes(Method method)

      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

          public static Type getReturnType(String methodDescriptor)

      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

          public static Type getReturnType(Method method)

      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

          public static int getArgumentsAndReturnSizes(String desc)

      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.
      返回:
        `VOID`, `BOOLEAN`, `CHAR`, `BYTE`, `SHORT`, `INT`, `FLOAT`, `LONG`, `DOUBLE`, `ARRAY`, `OBJECT` or `METHOD`.

    - #### 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

          public 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

          public String getClassName()

      Returns the binary name of the class corresponding to this type. This method must not be used on method types.
      返回:
        the binary name of the class corresponding to this type.

    - #### getInternalName

          public String getInternalName()

      Returns the internal name of the class corresponding to this object or array type. The internal name of a class is its fully qualified name (as returned by Class.getName(), where '.' are replaced by '/'. This method should only be used for an object or array type.
      返回:
        the internal name of the class corresponding to this object type.

    - #### getArgumentTypes

          public 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

          public 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

          public String getDescriptor()

      Returns the descriptor corresponding to this Java type.
      返回:
        the descriptor corresponding to this Java type.

    - #### getMethodDescriptor

          public static String getMethodDescriptor(Type returnType,
                                                   Type... argumentTypes)

      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

          public static String getInternalName(Class<?> c)

      Returns the internal name of the given class. The internal name of a class is its fully qualified name, as returned by Class.getName(), where '.' are replaced by '/'.
      参数:
        `c` - an object or array class.
      返回:
        the internal name of the given class.

    - #### getDescriptor

          public static String getDescriptor(Class<?> c)

      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

          public static String getConstructorDescriptor(Constructor<?> c)

      Returns the descriptor corresponding to the given constructor.
      参数:
        `c` - a `Constructor` object.
      返回:
        the descriptor of the given constructor.

    - #### getMethodDescriptor

          public static String getMethodDescriptor(Method m)

      Returns the descriptor corresponding to the given method.
      参数:
        `m` - a `Method` object.
      返回:
        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

          public boolean equals(Object o)

      Tests if the given object is equal to this type.
      覆盖:
        `equals` 在类中 `Object`
      参数:
        `o` - the object to be compared to this type.
      返回:
        `true` if the given object is equal to this type.

    - #### hashCode

          public int hashCode()

      Returns a hash code value for this type.
      覆盖:
        `hashCode` 在类中 `Object`
      返回:
        a hash code value for this type.

    - #### toString

          public String toString()

      Returns a string representation of this type.
      覆盖:
        `toString` 在类中 `Object`
      返回:
        the descriptor of this type.