saker.build Documentation TaskDoc JavaDoc Packages
public final class Type
A Java field or method type. This class can be used to make it easier to manipulate type and method descriptors.
Fields
public static final int
ARRAY = 9
The sort of array reference types.
public static final int
The sort of the boolean type.
public static final Type
The boolean type.
public static final int
BYTE = 3
The sort of the byte type.
public static final Type
The byte type.
public static final int
CHAR = 2
The sort of the char type.
public static final Type
The char type.
public static final int
DOUBLE = 8
The sort of the double type.
public static final Type
The double type.
public static final int
FLOAT = 6
The sort of the float type.
public static final Type
The float type.
public static final int
INT = 5
The sort of the int type.
public static final Type
The int type.
public static final int
LONG = 7
The sort of the long type.
public static final Type
The long type.
public static final int
METHOD = 11
The sort of method types.
public static final int
OBJECT = 10
The sort of object reference types.
public static final int
SHORT = 4
The sort of the short type.
public static final Type
The short type.
public static final int
VOID = 0
The sort of the void type.
public static final Type
The void type.
Methods
public boolean
equals(Object object)
Tests if the given object is equal to this type.
public Type[]
Returns the argument types of methods of this type.
public static Type[]
getArgumentTypes(String methodDescriptor)
Returns the Type values corresponding to the argument types of the given method descriptor.
public static Type[]
Returns the Type values corresponding to the argument types of the given method.
public int
Returns the size of the arguments and of the return value of methods of this type.
public static int
Computes the size of the arguments and of the return value of a method.
public String
Returns the binary name of the class corresponding to this type.
public static String
Returns the descriptor corresponding to the given constructor.
public String
Returns the descriptor corresponding to this type.
public static String
Returns the descriptor corresponding to the given class.
public int
Returns the number of dimensions of this array type.
public Type
Returns the type of the elements of this array type.
public String
Returns the internal name of the class corresponding to this object or array type.
public static String
Returns the internal name of the given class.
public static String
Returns the descriptor corresponding to the given method.
public static String
getMethodDescriptor(Type returnType, Type... argumentTypes)
Returns the descriptor corresponding to the given argument and return types.
public static Type
getMethodType(String methodDescriptor)
Returns the Type corresponding to the given method descriptor.
public static Type
getMethodType(Type returnType, Type... argumentTypes)
Returns the method Type corresponding to the given argument and return types.
public static Type
getObjectType(String internalName)
Returns the Type corresponding to the given internal name.
public int
getOpcode(int opcode)
Returns a JVM instruction opcode adapted to this Type.
public Type
Returns the return type of methods of this type.
public static Type
getReturnType(String methodDescriptor)
Returns the Type corresponding to the return type of the given method descriptor.
public static Type
Returns the Type corresponding to the return type of the given method.
public int
Returns the size of values of this type.
public int
Returns the sort of this type.
public static Type
getType(Class<?> clazz)
Returns the Type corresponding to the given class.
public static Type
getType(String typeDescriptor)
Returns the Type corresponding to the given type descriptor.
public static Type
getType(Constructor<?> constructor)
Returns the method Type corresponding to the given constructor.
public static Type
getType(Method method)
Returns the method Type corresponding to the given method.
public int
Returns a hash code value for this type.
public String
Returns a string representation of this type.
Inherited methods
From: Object
public static final int ARRAY = 9
The sort of array reference types. See getSort().
public static final int BOOLEAN = 1
The sort of the boolean type. See getSort().
public static final Type BOOLEAN_TYPE
The boolean type.
public static final int BYTE = 3
The sort of the byte type. See getSort().
public static final Type BYTE_TYPE
The byte type.
public static final int CHAR = 2
The sort of the char type. See getSort().
public static final Type CHAR_TYPE
The char type.
public static final int DOUBLE = 8
The sort of the double type. See getSort().
public static final Type DOUBLE_TYPE
The double type.
public static final int FLOAT = 6
The sort of the float type. See getSort().
public static final Type FLOAT_TYPE
The float type.
public static final int INT = 5
The sort of the int type. See getSort().
public static final Type INT_TYPE
The int type.
public static final int LONG = 7
The sort of the long type. See getSort().
public static final Type LONG_TYPE
The long type.
public static final int METHOD = 11
The sort of method types. See getSort().
public static final int OBJECT = 10
The sort of object reference types. See getSort().
public static final int SHORT = 4
The sort of the short type. See getSort().
public static final Type SHORT_TYPE
The short type.
public static final int VOID = 0
The sort of the void type. See getSort().
public static final Type VOID_TYPE
The void type.
public boolean equals(Object object)
Tests if the given object is equal to this type.
objectthe object to be compared to this type.
true if the given object is equal to this type.
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.
public static Type[] getArgumentTypes(String methodDescriptor)
Returns the Type values corresponding to the argument types of the given method descriptor.
methodDescriptora method descriptor.
the Type values corresponding to the argument types of the given method descriptor.
public static Type[] getArgumentTypes(Method method)
Returns the Type values corresponding to the argument types of the given method.
methoda method.
the Type values corresponding to the argument types of the given method.
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 of the method (plus one for the implicit this argument), argumentsSize, and the size of its return value, returnSize, packed into a single int i = (argumentsSize << 2) | returnSize (argumentsSize is therefore equal to i >> 2, and returnSize to i & 0x03).
public static int getArgumentsAndReturnSizes(String methodDescriptor)
Computes the size of the arguments and of the return value of a method.
methodDescriptora method descriptor.
the size of the arguments of the method (plus one for the implicit this argument), argumentsSize, and the size of its return value, returnSize, packed into a single int i = (argumentsSize << 2) | returnSize (argumentsSize is therefore equal to i >> 2, and returnSize to i & 0x03).
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.
public static String getConstructorDescriptor(Constructor<?> constructor)
Returns the descriptor corresponding to the given constructor.
constructora Constructor object.
the descriptor of the given constructor.
Returns the descriptor corresponding to this type.
the descriptor corresponding to this type.
public static String getDescriptor(Class<?> clazz)
Returns the descriptor corresponding to the given class.
clazzan object class, a primitive class or an array class.
the descriptor corresponding to the given class.
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.
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.
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.
public static String getInternalName(Class<?> clazz)
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 '/'.
clazzan object or array class.
the internal name of the given class.
public static String getMethodDescriptor(Method method)
Returns the descriptor corresponding to the given method.
methoda Method object.
the descriptor of the given method.
public static String getMethodDescriptor(Type returnType, Type... argumentTypes)
Returns the descriptor corresponding to the given argument and return types.
returnTypethe return type of the method.
argumentTypesthe argument types of the method.
the descriptor corresponding to the given argument and return types.
public static Type getMethodType(String methodDescriptor)
Returns the Type corresponding to the given method descriptor. Equivalent to Type.getType(methodDescriptor).
methodDescriptora method descriptor.
the Type corresponding to the given method descriptor.
public static Type getMethodType(Type returnType, Type... argumentTypes)
Returns the method Type corresponding to the given argument and return types.
returnTypethe return type of the method.
argumentTypesthe argument types of the method.
the method Type corresponding to the given argument and return types.
public static Type getObjectType(String internalName)
Returns the Type corresponding to the given internal name.
internalNamean internal name.
the Type corresponding to the given internal name.
public int getOpcode(int opcode)
Returns a JVM instruction opcode adapted to this Type. This method must not be used for method types.
opcodea 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 Type. For example, if this type is float and opcode is IRETURN, this method returns FRETURN.
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.
public static Type getReturnType(String methodDescriptor)
Returns the Type corresponding to the return type of the given method descriptor.
methodDescriptora method descriptor.
the Type corresponding to the return type of the given method descriptor.
public static Type getReturnType(Method method)
Returns the Type corresponding to the return type of the given method.
methoda method.
the Type corresponding to the return type of the given method.
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.
public int getSort()
Returns the sort of this type.
public static Type getType(Class<?> clazz)
Returns the Type corresponding to the given class.
clazza class.
the Type corresponding to the given class.
public static Type getType(String typeDescriptor)
Returns the Type corresponding to the given type descriptor.
typeDescriptora field or method type descriptor.
the Type corresponding to the given type descriptor.
public static Type getType(Constructor<?> constructor)
Returns the method Type corresponding to the given constructor.
constructora Constructor object.
the method Type corresponding to the given constructor.
public static Type getType(Method method)
Returns the method Type corresponding to the given method.
methoda Method object.
the method Type corresponding to the given method.
public int hashCode()
Returns a hash code value for this type.
a hash code value for this type.
public String toString()
Returns a string representation of this type.
the descriptor of this type.