Class DE.fub.inf.JVM.ClassGen.Type
java.lang.Object
|
+--DE.fub.inf.JVM.ClassGen.Type
- Subclasses:
- BasicType, ReferenceType
- public abstract class Type
- extends java.lang.Object
- implements Constants
Abstract super class for all possible java types, namely basic types
such as int, object types like String and array types, e.g. int[]
- Version:
- $Id: Type.java,v 1.5 1998/10/14 16:11:19 dahm Exp $
- Author:
- M. Dahm
Constructor Summary
|
Type(byte t,
java.lang.String s)
|
Method Summary
|
static Type[]
|
getArgumentTypes(java.lang.String signature)
Convert arguments of a method (signature) to an array of Type objects. |
static java.lang.String
|
getMethodSignature(Type return_type,
Type[] arg_types)
Convert type to Java method signature, e.g. int[] f(java.lang. |
static Type
|
getReturnType(java.lang.String signature)
Convert arguments of a method (signature) to a Type object. |
java.lang.String
|
getSignature()
|
int
|
getSize()
|
byte
|
getType()
|
static Type
|
getType(java.lang.String signature)
Convert signature to a Type object. |
java.lang.String
|
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
type
protected byte type
signature
protected java.lang.String signature
VOID
public static final Type VOID
- Predefined constants
BOOLEAN
public static final Type BOOLEAN
INT
public static final Type INT
SHORT
public static final Type SHORT
BYTE
public static final Type BYTE
LONG
public static final Type LONG
DOUBLE
public static final Type DOUBLE
FLOAT
public static final Type FLOAT
CHAR
public static final Type CHAR
NO_ARGS
public static final Type[] NO_ARGS
Type
protected Type(byte t,
java.lang.String s)
getSignature
public java.lang.String getSignature()
- Returns:
- signature for given type.
getType
public byte getType()
- Returns:
- type as defined in Constants
getSize
public int getSize()
- Returns:
- stack size of this type (2 for long and double, 0 for void, 1 otherwise)
toString
public java.lang.String toString()
- Returns:
- Type string, e.g. `int[]'
- Overrides:
- toString in class java.lang.Object
getMethodSignature
public static java.lang.String getMethodSignature(Type return_type,
Type[] arg_types)
- 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 returns
arg_types
- what are the argument types- Returns:
- method signature for given type(s).
getType
public static final Type getType(java.lang.String signature)
throws java.lang.StringIndexOutOfBoundsException
- Convert signature to a Type object.
- Parameters:
signature
- signature string such as Ljava/lang/String;- Returns:
- type object
getReturnType
public static Type getReturnType(java.lang.String signature)
- Convert arguments of a method (signature) to a Type object.
- Parameters:
signature
- signature string such as (Ljava/lang/String;)V- Returns:
- return type
getArgumentTypes
public static Type[] getArgumentTypes(java.lang.String signature)
- 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