Class constant.
For common system types, including all the primitive types, there are
predefined ClassDesc constants in ConstantDescs.
(The java.lang.constant APIs consider void to be a primitive type.)
To create a ClassDesc for a class or interface type, use of or
ofDescriptor(String); to create a ClassDesc for an array
type, use ofDescriptor(String), or first obtain a
ClassDesc for the component type and then call the arrayType()
or arrayType(int) methods.
ConstantDescs
| Modifier and Type | Method and Description |
|---|---|
| public ClassDesc | Returns: a ClassDesc describing the array typeRedeclares java. Returns a ClassDesc for an array type whose component type is described by this ClassDesc. |
| public ClassDesc | |
| public default ClassDesc | Returns: a ClassDesc describing the component type, ornull
if this descriptor does not describe an array typeImplements java. Returns the component type of this ClassDesc, if it describes
an array type, or |
| public String | Returns: the descriptor stringRedeclares java. Returns a field type descriptor string for this type |
| public String | Returns: a human-readable name for thisClassDescReturns a human-readable name for this |
| public boolean | |
| public default boolean | Returns: whether this ClassDesc describes an array typeImplements java. Returns whether this ClassDesc describes an array type. |
| public default boolean | Returns: whether this ClassDesc describes a class or interface typeReturns whether this ClassDesc describes a class or interface type. |
| public default boolean | Returns: whether this ClassDesc describes a primitive typeImplements java. Returns whether this ClassDesc describes a primitive type. |
| public default ClassDesc | |
| public default ClassDesc | Returns: a ClassDesc describing the nested classthe unqualified name of the first level of nested class firstNestedName, String... the unqualified name(s) of the remaining levels of
nested class moreNestedNames)Returns a ClassDesc for a nested class of the class or interface type described by this ClassDesc. |
| public static ClassDesc | |
| public static ClassDesc | Returns: a ClassDesc describing the desired classthe package name (dot-separated); if the package
name is the empty string, the class is considered to
be in the unnamed package packageName, String the unqualified (simple) class name className)Returns a ClassDesc for a class or interface type, given a package name and the unqualified (simple) name for the class or interface. |
| public static ClassDesc | Returns: a ClassDesc describing the desired classa field descriptor string descriptor)Returns a ClassDesc given a descriptor string for a class, interface, array, or primitive type. |
| public static ClassDesc | Returns: a ClassDesc describing the desired classthe fully qualified class name, in internal (slash-separated) form name)Returns a ClassDesc for a class or interface type,
given the name of the class or interface in internal form,
such as |
| public default String | Returns: the package name, or the empty string if the class is in the default package, or this ClassDesc does not describe a class or interface typeReturns the package name of this ClassDesc, if it describes a class or interface type. |
| public Class | resolveConstantDesc(MethodHandles.
Redeclares java. Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. |
| arrayType | back to summary |
|---|---|
| public ClassDesc arrayType() Redeclares java. Returns a ClassDesc for an array type whose component type is described by this ClassDesc.
| |
| arrayType | back to summary |
|---|---|
| public ClassDesc arrayType(int rank) Returns a ClassDesc for an array type of the specified rank, whose component type is described by this ClassDesc.
| |
| componentType | back to summary |
|---|---|
| public default ClassDesc componentType() Implements java. Returns the component type of this ClassDesc, if it describes
an array type, or | |
| descriptorString | back to summary |
|---|---|
| public String descriptorString() Redeclares java. Returns a field type descriptor string for this type
| |
| displayName | back to summary |
|---|---|
| public String displayName() Returns a human-readable name for this
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Compare the specified object with this descriptor for equality. Returns
| |
| isArray | back to summary |
|---|---|
| public default boolean isArray() Implements java. Returns whether this ClassDesc describes an array type.
| |
| isClassOrInterface | back to summary |
|---|---|
| public default boolean isClassOrInterface() Returns whether this ClassDesc describes a class or interface type.
| |
| isPrimitive | back to summary |
|---|---|
| public default boolean isPrimitive() Implements java. Returns whether this ClassDesc describes a primitive type.
| |
| nested | back to summary |
|---|---|
| public default ClassDesc nested(String nestedName) Returns a ClassDesc for a nested class of the class or interface type described by this ClassDesc. API Note Example: If descriptor
| |
| nested | back to summary |
|---|---|
| public default ClassDesc nested(String firstNestedName, String... moreNestedNames) Returns a ClassDesc for a nested class of the class or interface type described by this ClassDesc.
| |
| of | back to summary |
|---|---|
| public static ClassDesc of(String name) Returns a ClassDesc for a class or interface type,
given the name of the class or interface, such as
| |
| of | back to summary |
|---|---|
| public static ClassDesc of(String packageName, String className) Returns a ClassDesc for a class or interface type, given a package name and the unqualified (simple) name for the class or interface.
| |
| ofDescriptor | back to summary |
|---|---|
| public static ClassDesc ofDescriptor(String descriptor) Returns a ClassDesc given a descriptor string for a class, interface, array, or primitive type. API Note A field type descriptor string for a non-array type is either
a one-letter code corresponding to a primitive type
(
| |
| ofInternalName | back to summary |
|---|---|
| public static ClassDesc ofInternalName(String name) Returns a ClassDesc for a class or interface type,
given the name of the class or interface in internal form,
such as API Note To create a descriptor for an array type, either use
| |
| packageName | back to summary |
|---|---|
| public default String packageName() Returns the package name of this ClassDesc, if it describes a class or interface type. | |
| resolveConstantDesc | back to summary |
|---|---|
| public Class Redeclares java. Doc from java. Resolves this descriptor reflectively, emulating the resolution behavior
of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. The resolution
and access control context is provided by the
| |