Package org.apache.bcel.generic
Class Type
java.lang.Object
org.apache.bcel.generic.Type
- Direct Known Subclasses:
BasicType
,DOUBLE_Upper
,LONG_Upper
,ReferenceType
,ReturnaddressType
Abstract super class for all possible java types, namely basic types
such as int, object types like String and array types, e.g. int[]
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BasicType
static final BasicType
static final BasicType
static final ObjectType
private static final ThreadLocal<Integer>
static final BasicType
static final BasicType
static final BasicType
static final BasicType
static final Type[]
static final ReferenceType
static final ObjectType
static final BasicType
protected String
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterstatic final ObjectType
static final ObjectType
static final ObjectType
protected byte
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterstatic final Type
static final BasicType
Predefined constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static int
consumed
(int coded) (package private) static int
encode
(int size, int consumed) boolean
static Type[]
getArgumentTypes
(String signature) Convert arguments of a method (signature) to an array of Type objects.(package private) static int
getArgumentTypesSize
(String signature) static String
getMethodSignature
(Type return_type, Type[] arg_types) Convert type to Java method signature, e.g.static Type
getReturnType
(String signature) Convert return value of a method (signature) to a Type object.(package private) static int
getReturnTypeSize
(String signature) static String
getSignature
(Method meth) int
getSize()
byte
getType()
static Type
Convert runtime java.lang.Class to BCEL Type object.static Type
Convert signature to a Type object.static Type[]
Convert runtime java.lang.Class[] to BCEL Type objects.(package private) static int
getTypeSize
(String signature) int
hashCode()
boolean, short and char variable are considered as int in the stack or local variable area.(package private) void
setSignature
(String signature) (package private) static int
size
(int coded) toString()
private static int
unwrap
(ThreadLocal<Integer> tl) private static void
wrap
(ThreadLocal<Integer> tl, int value)
-
Field Details
-
type
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
signature
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
VOID
Predefined constants -
BOOLEAN
-
INT
-
SHORT
-
BYTE
-
LONG
-
DOUBLE
-
FLOAT
-
CHAR
-
OBJECT
-
CLASS
-
STRING
-
STRINGBUFFER
-
THROWABLE
-
NO_ARGS
-
NULL
-
UNKNOWN
-
consumed_chars
-
-
Constructor Details
-
Type
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getSignature
- Returns:
- signature for given type.
-
getType
public byte getType()- Returns:
- type as defined in Constants
-
normalizeForStackOrLocal
boolean, short and char variable are considered as int in the stack or local variable area. ReturnsINT
forBOOLEAN
,SHORT
orCHAR
, otherwise returns the given type.- Since:
- 6.0
-
getSize
public int getSize()- Returns:
- stack size of this type (2 for long and double, 0 for void, 1 otherwise)
-
toString
-
getMethodSignature
Convert type to Java method signature, e.g. int[] f(java.lang.String x) becomes (Ljava/lang/String;)[I- Parameters:
return_type
- what the method returnsarg_types
- what are the argument types- Returns:
- method signature for given type(s).
-
unwrap
-
wrap
-
getType
Convert signature to a Type object.- Parameters:
signature
- signature string such as Ljava/lang/String;- Returns:
- type object
- Throws:
StringIndexOutOfBoundsException
-
getReturnType
Convert return value of a method (signature) to a Type object.- Parameters:
signature
- signature string such as (Ljava/lang/String;)V- Returns:
- return type
-
getArgumentTypes
Convert arguments of a method (signature) to an array of Type objects.- Parameters:
signature
- signature string such as (Ljava/lang/String;)V- Returns:
- array of argument types
-
getType
Convert runtime java.lang.Class to BCEL Type object.- Parameters:
cl
- Java class- Returns:
- corresponding Type object
-
getTypes
Convert runtime java.lang.Class[] to BCEL Type objects.- Parameters:
classes
- an array of runtime class objects- Returns:
- array of corresponding Type objects
-
getSignature
-
size
static int size(int coded) -
consumed
static int consumed(int coded) -
encode
static int encode(int size, int consumed) -
getArgumentTypesSize
-
getTypeSize
- Throws:
StringIndexOutOfBoundsException
-
getReturnTypeSize
-
setSignature
-