Web Site

org.codehaus.janino
Class Descriptor

java.lang.Object
  extended by org.codehaus.janino.Descriptor

public class Descriptor
extends Object

Helper class that defines useful methods for handling "field descriptors" (JVMS 4.3.2) and "method descriptors" (JVMS 4.3.3).

Typical descriptors are:


Field Summary
static String BOOLEAN
           
static String BOOLEAN_
           
static String BYTE
           
static String BYTE_
           
static String CHAR_
           
static String CHARACTER
           
static String CLASS
           
static String CLONEABLE
           
static String DOUBLE
           
static String DOUBLE_
           
static String ERROR
           
static String FLOAT
           
static String FLOAT_
           
static String INT_
           
static String INTEGER
           
static String LONG
           
static String LONG_
           
static String OBJECT
           
static String RUNTIME_EXCEPTION
           
static String SERIALIZABLE
           
static String SHORT
           
static String SHORT_
           
static String STRING
           
static String STRING_BUFFER
           
static String STRING_BUILDER
           
static String THROWABLE
           
static String VOID_
           
 
Constructor Summary
Descriptor()
           
 
Method Summary
static boolean areInSamePackage(String d1, String d2)
          Check whether two reference types are declared in the same package.
static String fromClassName(String className)
          Convert a class name as defined by "Class.getName()" into a descriptor.
static String fromInternalForm(String internalForm)
          Convert a class name in the "internal form" as described in JVMS 4.2 into a descriptor.
static String getComponentDescriptor(String d)
           
static String getPackageName(String d)
          Returns the package name of a class or interface reference descriptor, or null if the class or interface is declared in the default package.
static boolean hasSize1(String d)
           
static boolean hasSize2(String d)
           
static boolean isArrayReference(String d)
           
static boolean isClassOrInterfaceReference(String d)
           
static boolean isPrimitive(String d)
           
static boolean isPrimitiveNumeric(String d)
           
static boolean isReference(String d)
           
static short size(String d)
           
static String toClassName(String d)
          Convert a field descriptor into a class name as defined by Class.getName().
static String toInternalForm(String d)
          Convert a descriptor into the "internal form" as defined by JVMS 4.2.
static String toString(String d)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VOID_

public static final String VOID_
See Also:
Constant Field Values

BYTE_

public static final String BYTE_
See Also:
Constant Field Values

CHAR_

public static final String CHAR_
See Also:
Constant Field Values

DOUBLE_

public static final String DOUBLE_
See Also:
Constant Field Values

FLOAT_

public static final String FLOAT_
See Also:
Constant Field Values

INT_

public static final String INT_
See Also:
Constant Field Values

LONG_

public static final String LONG_
See Also:
Constant Field Values

SHORT_

public static final String SHORT_
See Also:
Constant Field Values

BOOLEAN_

public static final String BOOLEAN_
See Also:
Constant Field Values

OBJECT

public static final String OBJECT
See Also:
Constant Field Values

STRING

public static final String STRING
See Also:
Constant Field Values

STRING_BUFFER

public static final String STRING_BUFFER
See Also:
Constant Field Values

STRING_BUILDER

public static final String STRING_BUILDER
See Also:
Constant Field Values

CLASS

public static final String CLASS
See Also:
Constant Field Values

THROWABLE

public static final String THROWABLE
See Also:
Constant Field Values

RUNTIME_EXCEPTION

public static final String RUNTIME_EXCEPTION
See Also:
Constant Field Values

ERROR

public static final String ERROR
See Also:
Constant Field Values

CLONEABLE

public static final String CLONEABLE
See Also:
Constant Field Values

SERIALIZABLE

public static final String SERIALIZABLE
See Also:
Constant Field Values

BOOLEAN

public static final String BOOLEAN
See Also:
Constant Field Values

BYTE

public static final String BYTE
See Also:
Constant Field Values

CHARACTER

public static final String CHARACTER
See Also:
Constant Field Values

SHORT

public static final String SHORT
See Also:
Constant Field Values

INTEGER

public static final String INTEGER
See Also:
Constant Field Values

LONG

public static final String LONG
See Also:
Constant Field Values

FLOAT

public static final String FLOAT
See Also:
Constant Field Values

DOUBLE

public static final String DOUBLE
See Also:
Constant Field Values
Constructor Detail

Descriptor

public Descriptor()
Method Detail

isReference

public static boolean isReference(String d)

isClassOrInterfaceReference

public static boolean isClassOrInterfaceReference(String d)

isArrayReference

public static boolean isArrayReference(String d)

getComponentDescriptor

public static String getComponentDescriptor(String d)

size

public static short size(String d)

hasSize1

public static boolean hasSize1(String d)

hasSize2

public static boolean hasSize2(String d)

toString

public static String toString(String d)

fromClassName

public static String fromClassName(String className)
Convert a class name as defined by "Class.getName()" into a descriptor.


fromInternalForm

public static String fromInternalForm(String internalForm)
Convert a class name in the "internal form" as described in JVMS 4.2 into a descriptor.

Also implement the encoding of array types as described in JVMS 4.4.1.


toClassName

public static String toClassName(String d)
Convert a field descriptor into a class name as defined by Class.getName().


toInternalForm

public static String toInternalForm(String d)
Convert a descriptor into the "internal form" as defined by JVMS 4.2.


isPrimitive

public static boolean isPrimitive(String d)

isPrimitiveNumeric

public static boolean isPrimitiveNumeric(String d)

getPackageName

public static String getPackageName(String d)
Returns the package name of a class or interface reference descriptor, or null if the class or interface is declared in the default package.


areInSamePackage

public static boolean areInSamePackage(String d1,
                                       String d2)
Check whether two reference types are declared in the same package.


Web Site