public final class Descriptor extends Object
Typical descriptors are:
I
Integer
[I
Array of integer
Lpkg1/pkg2/Cls;
Class
Lpkg1/pkg2/Outer$Inner;
Member class
Modifier and Type | Field and Description |
---|---|
static String |
BOOLEAN
The field descriptor for the primitive type BOOLEAN.
|
static String |
BYTE
The field descriptor for the primitive type BYTE.
|
static String |
CHAR
The field descriptor for the primitive type CHAR.
|
static String |
DOUBLE
The field descriptor for the primitive type DOUBLE.
|
static String |
FLOAT
The field descriptor for the primitive type FLOAT.
|
static String |
INT
The field descriptor for the primitive type INT.
|
static String |
JAVA_IO_SERIALIZABLE
The field descriptor for the interface
Serializable . |
static String |
JAVA_LANG_ASSERTIONERROR
The field descriptor for the class
AssertionError . |
static String |
JAVA_LANG_BOOLEAN
The field descriptor for the class
Boolean . |
static String |
JAVA_LANG_BYTE
The field descriptor for the class
Byte . |
static String |
JAVA_LANG_CHARACTER
The field descriptor for the class
Character . |
static String |
JAVA_LANG_CLASS
The field descriptor for the class
Class . |
static String |
JAVA_LANG_CLONEABLE
The field descriptor for the interface
Cloneable . |
static String |
JAVA_LANG_DOUBLE
The field descriptor for the class
Double . |
static String |
JAVA_LANG_ERROR
The field descriptor for the class
Error . |
static String |
JAVA_LANG_EXCEPTION
The field descriptor for the class
Exception . |
static String |
JAVA_LANG_FLOAT
The field descriptor for the class
Float . |
static String |
JAVA_LANG_INTEGER
The field descriptor for the class
Integer . |
static String |
JAVA_LANG_ITERABLE
The field descriptor for the interface
Iterable . |
static String |
JAVA_LANG_LONG
The field descriptor for the class
Long . |
static String |
JAVA_LANG_OBJECT
The field descriptor for the class
Object . |
static String |
JAVA_LANG_OVERRIDE
The field descriptor for the annotation
Override . |
static String |
JAVA_LANG_RUNTIMEEXCEPTION
The field descriptor for the class
RuntimeException . |
static String |
JAVA_LANG_SHORT
The field descriptor for the class
Short . |
static String |
JAVA_LANG_STRING
The field descriptor for the class
String . |
static String |
JAVA_LANG_STRINGBUILDER
The field descriptor for the class
StringBuilder . |
static String |
JAVA_LANG_THROWABLE
The field descriptor for the class
Throwable . |
static String |
JAVA_UTIL_ITERATOR
The field descriptor for the interface
Iterator . |
static String |
LONG
The field descriptor for the primitive type LONG.
|
static String |
SHORT
The field descriptor for the primitive type SHORT.
|
static String |
VOID
The field descriptor for the type VOID.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areInSamePackage(String d1,
String d2)
Checks whether two reference types are declared in the same package.
|
static String |
fromClassName(String className)
Converts 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)
Converts a field descriptor into a class name as defined by
Class.getName() . |
static String |
toInternalForm(String d)
Converts a descriptor into the "internal form" as defined by JVMS 4.2.
|
static String |
toString(String d)
Pretty-prints the given descriptor.
|
public static final String VOID
public static final String BYTE
public static final String CHAR
public static final String DOUBLE
public static final String FLOAT
public static final String INT
public static final String LONG
public static final String SHORT
public static final String BOOLEAN
public static final String JAVA_LANG_OVERRIDE
Override
.public static final String JAVA_LANG_ASSERTIONERROR
AssertionError
.public static final String JAVA_LANG_BOOLEAN
Boolean
.public static final String JAVA_LANG_BYTE
Byte
.public static final String JAVA_LANG_CHARACTER
Character
.public static final String JAVA_LANG_CLASS
Class
.public static final String JAVA_LANG_DOUBLE
Double
.public static final String JAVA_LANG_EXCEPTION
Exception
.public static final String JAVA_LANG_ERROR
Error
.public static final String JAVA_LANG_FLOAT
Float
.public static final String JAVA_LANG_INTEGER
Integer
.public static final String JAVA_LANG_LONG
Long
.public static final String JAVA_LANG_OBJECT
Object
.public static final String JAVA_LANG_RUNTIMEEXCEPTION
RuntimeException
.public static final String JAVA_LANG_SHORT
Short
.public static final String JAVA_LANG_STRING
String
.public static final String JAVA_LANG_STRINGBUILDER
StringBuilder
.public static final String JAVA_LANG_THROWABLE
Throwable
.public static final String JAVA_IO_SERIALIZABLE
Serializable
.public static final String JAVA_LANG_CLONEABLE
Cloneable
.public static final String JAVA_LANG_ITERABLE
Iterable
.public static final String JAVA_UTIL_ITERATOR
Iterator
.public static boolean isReference(String d)
Descriptor
describes a reference (i.e. non-primitive) typepublic static boolean isClassOrInterfaceReference(String d)
Descriptor
describes a class or an interface (and not an array or a primitive type)public static boolean isArrayReference(String d)
Descriptor
describes an array typepublic static String getComponentDescriptor(String d)
d
JaninoRuntimeException
- d
does not describe an array typepublic static short size(String d)
d
occupies on the operand
stack or in the local variable array, or 0 iff d
describes the type VOIDpublic static boolean hasSize1(String d)
true
iff d
describes a primitive type except LONG and DOUBLE, or a reference typepublic static boolean hasSize2(String d)
true
iff d
LONG or DOUBLEpublic static String toString(String d)
d
- A valid field or method descriptorpublic static String fromClassName(String className)
public static String fromInternalForm(String internalForm)
Also implement the encoding of array types as described in JVMS 4.4.1.
public static String toClassName(String d)
Class.getName()
.public static String toInternalForm(String d)
public static boolean isPrimitive(String d)
d
describes a primitive type or VOIDpublic static boolean isPrimitiveNumeric(String d)
d
describes a primitive type except BOOLEAN and VOIDpublic static String getPackageName(String d)
null
if the class or interface is declared in the
default package.Copyright © 2001–2016. All rights reserved.