org.objectweb.asm
Class Type
A Java type. This class can be used to make it easier to manipulate type
and method descriptors.
- Eric Bruneton, Chris Nokleberg
boolean | equals(Object o) - Tests if the given object is equal to 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 name of the class corresponding to this type.
|
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 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.
|
int | getOpcode(int opcode) - Returns a JVM instruction opcode adapted to this Java 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(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.
|
ARRAY
public static final int ARRAY
The sort of array reference types. See
getSort
.
BOOLEAN
public static final int BOOLEAN
The sort of the
boolean type. See
getSort
.
BOOLEAN_TYPE
public static final Type BOOLEAN_TYPE
The boolean type.
BYTE
public static final int BYTE
The sort of the
byte type. See
getSort
.
BYTE_TYPE
public static final Type BYTE_TYPE
The byte type.
CHAR
public static final int CHAR
The sort of the
char type. See
getSort
.
CHAR_TYPE
public static final Type CHAR_TYPE
The char type.
DOUBLE
public static final int DOUBLE
The sort of the
double type. See
getSort
.
DOUBLE_TYPE
public static final Type DOUBLE_TYPE
The double type.
FLOAT
public static final int FLOAT
The sort of the
float type. See
getSort
.
FLOAT_TYPE
public static final Type FLOAT_TYPE
The float type.
INT
public static final int INT
The sort of the
int type. See
getSort
.
INT_TYPE
public static final Type INT_TYPE
The int type.
LONG
public static final int LONG
The sort of the
long type. See
getSort
.
LONG_TYPE
public static final Type LONG_TYPE
The long type.
OBJECT
public static final int OBJECT
The sort of object reference type. See
getSort
.
SHORT
public static final int SHORT
The sort of the
short type. See
getSort
.
SHORT_TYPE
public static final Type SHORT_TYPE
The short type.
VOID
public static final int VOID
The sort of the
void type. See
getSort
.
VOID_TYPE
public static final Type VOID_TYPE
The void type.
equals
public boolean equals(Object o)
Tests if the given object is equal to this type.
o
- the object to be compared to this type.
- true if the given object is equal to this type.
getArgumentTypes
public static Type[] getArgumentTypes(Method method)
Returns the Java types corresponding to the argument types of the given
method.
- the Java types corresponding to the argument types of 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.
getClassName
public String getClassName()
Returns the name of the class corresponding to this type.
- the fully qualified name of the class corresponding to this type.
getDescriptor
public String getDescriptor()
Returns the descriptor corresponding to this Java type.
- the descriptor corresponding to this Java type.
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.
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.
getInternalName
public String getInternalName()
Returns the internal name of the class corresponding to this object type.
The internal name of a class is its fully qualified name, where '.' are
replaced by '/'. This method should only be used for an object type.
- the internal name of the class corresponding to this object type.
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, where '.' are replaced by '/'.
- the internal name of the given class.
getMethodDescriptor
public static String getMethodDescriptor(Method m)
Returns the descriptor corresponding to the given method.
- the descriptor of the given method.
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.
getOpcode
public int getOpcode(int opcode)
Returns a JVM instruction opcode adapted to this Java type.
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.
getReturnType
public static Type getReturnType(Method method)
Returns the Java type corresponding to the return type of the given
method.
- the Java type corresponding to the return type 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.
getSize
public int getSize()
Returns the size of values of this type.
- the size of values of this type, i.e., 2 for long and
double, and 1 otherwise.
getSort
public int getSort()
Returns the sort of this Java type.
getType
public static Type getType(Class c)
Returns the Java type corresponding to the given class.
- the Java type corresponding to the given class.
getType
public static Type getType(String typeDescriptor)
Returns the Java type corresponding to the given type descriptor.
typeDescriptor
- a type descriptor.
- the Java type corresponding to the given type descriptor.
hashCode
public int hashCode()
Returns a hash code value for this type.
- a hash code value for this type.
toString
public String toString()
Returns a string representation of this type.
- the descriptor of this type.