Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.bcel.generic
Class Type

    java.lang.Object
      |
      +--org.apache.bcel.generic.Type

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  BasicType, DOUBLE_Upper, LONG_Upper, ReferenceType, ReturnaddressType

public abstract class Type
extends java.lang.Object
implements java.io.Serializable

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.8 2002/08/07 18:01:32 mdahm Exp $
Author:
  M. Dahm
See Also:
  Serialized Form

Field Summary
`static BasicType` | `BOOLEAN`
`static BasicType` | `BYTE`
`static BasicType` | `CHAR`
`static BasicType` | `DOUBLE`
`static BasicType` | `FLOAT`
`static BasicType` | `INT`
`static BasicType` | `LONG`
`static Type[]` | `NO_ARGS`
`static ReferenceType` | `NULL`
`static ObjectType` | `OBJECT`
`static BasicType` | `SHORT`
`protected java.lang.String` | `signature`
`static ObjectType` | `STRING`
`static ObjectType` | `STRINGBUFFER`
`static ObjectType` | `THROWABLE`
`protected byte` | `type`
`static Type` | `UNKNOWN`
`static BasicType` | `VOID` Predefined constants

Constructor Summary
`protected` | `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.String x) becomes (Ljava/lang/String;)[I
`static Type` | `getReturnType(java.lang.String signature)` Convert return value of a method (signature) to a Type object.
`java.lang.String` | `getSignature()`
`static java.lang.String` | `getSignature(java.lang.reflect.Method meth)`
`int` | `getSize()`
`byte` | `getType()`
`static Type` | `getType(java.lang.Class cl)` Convert runtime java.lang.Class to BCEL Type object.
`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, notify, notifyAll, wait, wait, wait`

Field Detail

### type

    protected byte type

### signature

    protected java.lang.String signature

### VOID

    public static final BasicType VOID

  Predefined constants

### BOOLEAN

    public static final BasicType BOOLEAN

### INT

    public static final BasicType INT

### SHORT

    public static final BasicType SHORT

### BYTE

    public static final BasicType BYTE

### LONG

    public static final BasicType LONG

### DOUBLE

    public static final BasicType DOUBLE

### FLOAT

    public static final BasicType FLOAT

### CHAR

    public static final BasicType CHAR

### OBJECT

    public static final ObjectType OBJECT

### STRING

    public static final ObjectType STRING

### STRINGBUFFER

    public static final ObjectType STRINGBUFFER

### THROWABLE

    public static final ObjectType THROWABLE

### NO_ARGS

    public static final Type[] NO_ARGS

### NULL

    public static final ReferenceType NULL

### UNKNOWN

    public static final Type UNKNOWN

Constructor Detail

### Type

    protected Type(byte t,
                   java.lang.String s)

Method Detail

### 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()

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    Type string, e.g. `int[]'

### 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
    `java.lang.StringIndexOutOfBoundsException`

### getReturnType

    public static Type getReturnType(java.lang.String signature)

  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

    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

### getType

    public static Type getType(java.lang.Class cl)

  Convert runtime java.lang.Class to BCEL Type object.

  Parameters:
    `cl` - Java class
  Returns:
    corresponding Type object

### getSignature

    public static java.lang.String getSignature(java.lang.reflect.Method meth)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2003 Apache Software Foundation. All Rights Reserved.