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 BasicTypestatic final BasicTypestatic final BasicTypestatic final ObjectTypeprivate static final ThreadLocal<Integer> static final BasicTypestatic final BasicTypestatic final BasicTypestatic final BasicTypestatic final Type[]Empty array.static final ReferenceTypestatic final ObjectTypestatic final BasicTypeprotected StringDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterstatic final ObjectTypestatic final ObjectTypestatic final ObjectTypeprotected byteDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterstatic final Typestatic final BasicTypePredefined constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intconsumed(int coded) (package private) static intencode(int size, int consumed) booleanstatic Type[]getArgumentTypes(String signature) Convert arguments of a method (signature) to an array of Type objects.(package private) static intgetArgumentTypesSize(String signature) static StringgetMethodSignature(Type returnType, Type[] argTypes) Convert type to Java method signature, e.g.static TypegetReturnType(String signature) Convert return value of a method (signature) to a Type object.(package private) static intgetReturnTypeSize(String signature) static StringgetSignature(Method meth) intgetSize()bytegetType()static TypeConvert runtimeClassto BCEL Type object.static TypeConvert signature to a Type object.static Type[]Convert runtimejava.lang.Class[]to BCEL Type objects.(package private) static intgetTypeSize(String signature) inthashCode()(package private) static StringinternalTypeNameToSignature(String internalTypeName) boolean, short and char variable are considered as int in the stack or local variable area.(package private) static intsize(int coded) toString()private static intunwrap(ThreadLocal<Integer> tl) private static voidwrap(ThreadLocal<Integer> tl, int value)
-
Field Details
-
VOID
Predefined constants -
BOOLEAN
-
INT
-
SHORT
-
BYTE
-
LONG
-
DOUBLE
-
FLOAT
-
CHAR
-
OBJECT
-
CLASS
-
STRING
-
STRINGBUFFER
-
THROWABLE
-
NO_ARGS
Empty array. -
NULL
-
UNKNOWN
-
CONSUMED_CHARS
-
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
-
-
Constructor Details
-
Type
-
-
Method Details
-
consumed
static int consumed(int coded) -
encode
static int encode(int size, int consumed) -
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
-
getArgumentTypesSize
-
getMethodSignature
Convert type to Java method signature, e.g. int[] f(java.lang.String x) becomes (Ljava/lang/String;)[I- Parameters:
returnType- what the method returnsargTypes- what are the argument types- Returns:
- method signature for given type(s).
-
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
-
getReturnTypeSize
-
getSignature
-
getType
Convert runtimeClassto BCEL Type object.- Parameters:
cls- Java class- Returns:
- corresponding Type object
-
getType
Convert signature to a Type object.- Parameters:
signature- signature string such as Ljava/lang/String;- Returns:
- type object
- Throws:
StringIndexOutOfBoundsException
-
getTypes
Convert runtimejava.lang.Class[]to BCEL Type objects.- Parameters:
classes- an array of runtime class objects- Returns:
- array of corresponding Type objects
-
getTypeSize
- Throws:
StringIndexOutOfBoundsException
-
internalTypeNameToSignature
-
size
static int size(int coded) -
unwrap
-
wrap
-
equals
-
getClassName
-
getSignature
- Returns:
- signature for given type.
-
getSize
public int getSize()- Returns:
- stack size of this type (2 for long and double, 0 for void, 1 otherwise)
-
getType
public byte getType()- Returns:
- type as defined in Constants
-
hashCode
public int hashCode() -
normalizeForStackOrLocal
boolean, short and char variable are considered as int in the stack or local variable area. ReturnsINTforBOOLEAN,SHORTorCHAR, otherwise returns the given type.- Since:
- 6.0
-
toString
-