public class Type
extends java.lang.Object
The method String f(int a, boolean b, Object c) has the type descriptor:
Constant| Modifier and Type | Field and Description |
|---|---|
static Type |
ADDRESS |
static char |
ADDRESS_CHAR |
static char |
ARRAY_CHAR |
static Type |
BOOLEAN |
static char |
BOOLEAN_CHAR |
static int |
BOOLEAN_CODE |
static Type |
BYTE |
static char |
BYTE_CHAR |
static int |
BYTE_CODE |
static Type |
CHARACTER |
static char |
CHARACTER_CHAR |
static int |
CHARACTER_CODE |
static Type |
CLASS |
static char |
CLASS_CHAR |
static Type |
CLONEABLE |
static Type |
DOUBLE |
static char |
DOUBLE_CHAR |
static int |
DOUBLE_CODE |
static Type |
FLOAT |
static char |
FLOAT_CHAR |
static int |
FLOAT_CODE |
static Type |
INTEGER |
static char |
INTEGER_CHAR |
static int |
INTEGER_CODE |
static Type |
LONG |
static char |
LONG_CHAR |
static int |
LONG_CODE |
static Type |
NULL |
static Type |
OBJECT |
static boolean |
PRINT_TRUNCATED
Print truncated (abbreviated) type names.
|
static Type |
SERIALIZABLE |
static Type |
SHORT |
static char |
SHORT_CHAR |
static int |
SHORT_CODE |
static Type |
STRING |
static Type |
THROWABLE |
static Type |
VOID |
static char |
VOID_CHAR |
| Modifier and Type | Method and Description |
|---|---|
Type |
arrayType()
Get a Type representing an array of this type.
|
Type |
arrayType(int dimensions)
Create a Type representing a multidimensional array of this type.
|
static java.lang.String |
classDescriptor(java.lang.String name)
Get the type descriptor of a class from a string representation..
|
java.lang.String |
className()
Get the class name of the type.
|
static java.util.Comparator |
comparator()
Returns a Comparator used to compare Types.
|
java.lang.String |
descriptor()
Get a descriptor of the type.
|
int |
dimensions()
Get the number of dimensions of an array type.
|
Type |
elementType()
Get the element type of an array type.
|
Type |
elementType(int dimensions)
Get the element type of this array type.
|
boolean |
equals(java.lang.Object obj)
Returns true if two Types are equal.
|
static Type |
getType(char typeChar)
Returns a Type of a primitive type based on a one-character
type descriptor.
|
static Type |
getType(java.lang.Class c)
Returns a
Type that represents a given Class. |
static Type |
getType(int typeCode)
Returns a Type for a primitive type based on its integer "type
code".
|
static Type |
getType(java.lang.String desc)
Returns a Type of a given descriptor.
|
static Type |
getType(Type[] paramTypes,
Type returnType)
Returns the Type for a method with the given parameter and return types
|
int |
hashCode()
Hash the type.
|
Type[] |
indexedParamTypes()
If this Type is a method type, get the parameter types of the method,
including empty positions for the second word of wide types.
|
boolean |
isAddress()
Check if the type is a returnAddress.
|
boolean |
isArray()
Check if the type is an array type.
|
boolean |
isIntegral()
Check if the type is an integral type.
|
boolean |
isMethod()
Check if the type is a method type.
|
boolean |
isNull()
Check if the type is a null type.
|
boolean |
isObject()
Check if the type is an object type (not array).
|
boolean |
isPrimitive()
Check if the type is a primitive type.
|
boolean |
isReference()
Check if the type is an array or object.
|
boolean |
isVoid()
Check if the type is a void type.
|
boolean |
isWide()
Check if the type takes of 2 local variable or stack positions.
|
static void |
main(java.lang.String[] args)
Test truncatedName.
|
Type[] |
paramTypes()
Get the parameter types of the method, not including empty positions for
the second word of wide types.
|
static java.util.Comparator |
printComparator()
Returns a Comparator that compares Types based on
how they are displayed.
|
java.lang.String |
qualifier()
Get the qualifier of the type.
|
Type |
returnType()
Get a return type of a method type.
|
java.lang.String |
shortName()
Get a one character name for the type.
|
Type |
simple()
Get a simplification of the type.
|
int |
stackHeight()
Returns the number of slots in the stack that this Type takes up on the
JVM stack.
|
java.lang.String |
toString()
Convert the type to a string.
|
static java.lang.String |
truncatedName(Type type)
Returns a string representing the truncated name of a Type.
|
int |
typeCode()
Get the type code of the type (which must be a primitive type).
|
public static final char ARRAY_CHAR
public static final char BOOLEAN_CHAR
public static final char BYTE_CHAR
public static final char CHARACTER_CHAR
public static final char CLASS_CHAR
public static final char DOUBLE_CHAR
public static final char FLOAT_CHAR
public static final char INTEGER_CHAR
public static final char LONG_CHAR
public static final char SHORT_CHAR
public static final char VOID_CHAR
public static final char ADDRESS_CHAR
public static final int BOOLEAN_CODE
public static final int CHARACTER_CODE
public static final int FLOAT_CODE
public static final int DOUBLE_CODE
public static final int BYTE_CODE
public static final int SHORT_CODE
public static final int INTEGER_CODE
public static final int LONG_CODE
public static final Type OBJECT
public static final Type STRING
public static final Type CLASS
public static final Type THROWABLE
public static final Type CLONEABLE
public static final Type SERIALIZABLE
public static final Type NULL
public static final Type BOOLEAN
public static final Type CHARACTER
public static final Type FLOAT
public static final Type DOUBLE
public static final Type BYTE
public static final Type SHORT
public static final Type INTEGER
public static final Type LONG
public static final Type VOID
public static final Type ADDRESS
public static boolean PRINT_TRUNCATED
public static Type getType(java.lang.String desc)
public static Type getType(java.lang.Class c)
Type that represents a given Class.public static Type getType(Type[] paramTypes, Type returnType)
public static Type getType(int typeCode)
public static Type getType(char typeChar)
public int typeCode()
java.lang.IllegalArgumentException - If the type is not primitive.public java.lang.String shortName()
public Type simple()
public java.lang.String descriptor()
public boolean isMethod()
public boolean isNull()
public boolean isVoid()
public boolean isPrimitive()
public boolean isIntegral()
public boolean isArray()
public boolean isObject()
public boolean isWide()
public boolean isAddress()
public boolean isReference()
public static java.lang.String classDescriptor(java.lang.String name)
name - The name of the class.public java.lang.String className()
public java.lang.String qualifier()
public int dimensions()
public Type arrayType()
public Type arrayType(int dimensions)
public Type elementType(int dimensions)
dimensions - The number of times to index into the array.java.lang.IllegalArgumentException - If the type is not an array.public Type elementType()
java.lang.IllegalArgumentException - If the type is not an array.public Type returnType()
public Type[] indexedParamTypes()
public Type[] paramTypes()
public int stackHeight()
It also give you an idea of how may parameters a method has.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static java.util.Comparator comparator()
public static java.util.Comparator printComparator()
public static java.lang.String truncatedName(Type type)
public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)