Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.jdeveloper.java.legacy
Class JotNames

java.lang.Object
  extended by oracle.jdeveloper.java.legacy.JotNames

public class JotNames
extends java.lang.Object

This class contains the legacy routines from oracle.jdeveloper.jot.JotNames for manipulating Java names and identifiers.

From JotNames:

Provides utility methods for manipulating Java names and identifiers.

Java class names are expressed in three forms: Java names, as used in Java source code; signature descriptors; and modified signature descriptors. The relationship between the three forms is shown in this table.

Java source Signature Descriptor Modified Signature Descriptor
byteBB
charCC
doubleDD
floatFF
intII
longJJ
shortSS
booleanZZ
package.Class Lpackage/Class; Lpackage.Class;
type[][type [type
The signature formats differ only in the choice of a class delimiter character.

See Also:
"The Java Virtual Machine Specification, section 4.3.2"

Field Summary
static java.lang.Class[] PRIMITIVE_CLASSES
          An array of the Java class objects that represent primitive types.
static java.lang.String SIGS
          The string of type descriptors: "L[BCDFIJSVZ".
static java.lang.String[] TYPES
          An array of Java type names.
 
Constructor Summary
JotNames()
           
 
Method Summary
static java.lang.Class classForName(java.lang.String type)
          Loads the named class using the default loader.
static java.lang.String dotSignatureToType(java.lang.String signature)
          Converts a modified signature descriptor into a Java type name.
static java.lang.String getClassName(java.lang.String pkg, java.lang.String name)
          Concatenates a package name and a class name to produce a class name.
static java.lang.String getPackageFromFullClassName(java.lang.String fullName)
          Extracts the package name from a qualified name.
static java.lang.String getShortClassName(java.lang.String fullName)
          Extracts a class name from a qualified name.
static int getSignatureItemCount(java.lang.String signature)
          Retrieves the number of field descriptors in a signature.
static boolean isKeyword(java.lang.String name)
          Returns true if name is a Java keyword.
static boolean isValidClassName(java.lang.String name)
          Returns true if name is a valid Java class name.
static boolean isValidIdentifier(java.lang.String name)
          Returns true if name is a valid Java identifier.
static java.lang.Class primitiveClassForName(java.lang.String dotSignature)
          Retrieves the class object representing a primitive type.
static java.lang.String signatureToType(java.lang.String signature)
          Converts a signature descriptor into a Java type name.
static java.lang.String[] signatureToTypes(java.lang.String signature)
          Converts a string of signature descriptors into an array of Java type names.
static java.lang.String typeToDotSignature(java.lang.String type)
          Converts a Java type name into a modified signature descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGS

public static final java.lang.String SIGS
The string of type descriptors: "L[BCDFIJSVZ". Each character is a code for a type. This list is arranged to be parallel to TYPES.

See Also:
"The Java Virtual Machine Specification, section 4.3.2", TYPES, Constant Field Values

TYPES

public static final java.lang.String[] TYPES
An array of Java type names. The elements are the names of primitive types plus "<class>" and "<array>"


PRIMITIVE_CLASSES

public static final java.lang.Class[] PRIMITIVE_CLASSES
An array of the Java class objects that represent primitive types. This array is arranged to be parallel to TYPES.

See Also:
TYPES
Constructor Detail

JotNames

public JotNames()
Method Detail

getClassName

public static final java.lang.String getClassName(java.lang.String pkg,
                                                  java.lang.String name)
Concatenates a package name and a class name to produce a class name.

Parameters:
pkg - a package name or null.
name - an identifier.
Returns:
pkg + "." + name, or name alone if pkg is null or empty.

getShortClassName

public static final java.lang.String getShortClassName(java.lang.String fullName)
Extracts a class name from a qualified name.

Parameters:
fullName - a Java name; a sequence of identifiers with interspersed '.' tokens.
Returns:
the identifier that follows the last '.' token, or all of fullName if it contains no '.' tokens.

getPackageFromFullClassName

public static final java.lang.String getPackageFromFullClassName(java.lang.String fullName)
Extracts the package name from a qualified name.

Parameters:
fullName - a Java name; a sequence of identifiers with interspersed '.' tokens.
Returns:
the portion of fullName that precedes the last '.' token, or the empty string if fullName contains no '.' tokens.

isKeyword

public static boolean isKeyword(java.lang.String name)
Returns true if name is a Java keyword.

Parameters:
name - a string.

isValidIdentifier

public static boolean isValidIdentifier(java.lang.String name)
Returns true if name is a valid Java identifier.

Parameters:
name - a string.

isValidClassName

public static boolean isValidClassName(java.lang.String name)
Returns true if name is a valid Java class name. A class name is a sequence of identifiers with interspersed '.' tokens.

Parameters:
name - a string.

typeToDotSignature

public static final java.lang.String typeToDotSignature(java.lang.String type)
Converts a Java type name into a modified signature descriptor.

Parameters:
type - a qualified name of a Java primitive, class, or array type.
Returns:
a descriptor string in which '.' tokens are substituted for '/' tokens.
See Also:
"The Java Virtual Machine Specification, section 4.3.2"

dotSignatureToType

public static java.lang.String dotSignatureToType(java.lang.String signature)
Converts a modified signature descriptor into a Java type name.

Parameters:
signature - a descriptor string in which '.' tokens are substituted for '/' tokens.
Returns:
a qualified Java primitive, class, or array type name, or signature unchanged if signature is not a descriptor.
See Also:
"The Java Virtual Machine Specification, section 4.3.2"

signatureToType

public static java.lang.String signatureToType(java.lang.String signature)
Converts a signature descriptor into a Java type name.

Parameters:
signature - a descriptor string.
Returns:
a qualified Java primitive, class, or array type name. Return null if signature is not a descriptor.
See Also:
"The Java Virtual Machine Specification, section 4.3.2"

getSignatureItemCount

public static int getSignatureItemCount(java.lang.String signature)
Retrieves the number of field descriptors in a signature. For example, the signature ILjava/lang/String;[Ljava/lang/String; has three descriptors, I, Ljava/lang/String;, and [Ljava/lang/String;. These would correspond to the types int, java.lang.String, and java.lang.String[].

Parameters:
signature - the signature, expressed as a String composed of field descriptors.
Returns:
the number of field descriptors in the signature.
See Also:
"Section 4.3.2 of the Java Virtual Machine Specification Second Edition"

signatureToTypes

public static java.lang.String[] signatureToTypes(java.lang.String signature)
Converts a string of signature descriptors into an array of Java type names.

Parameters:
signature - a descriptor string.
Returns:
an array of qualified Java primitive, class, or array type names.
See Also:
"The Java Virtual Machine Specification, section 4.3.2"

classForName

public static final java.lang.Class classForName(java.lang.String type)
                                          throws java.lang.ClassNotFoundException
Loads the named class using the default loader.

Parameters:
type - a qualified Java primitive, class, or array type name.
Returns:
the named class.
Throws:
java.lang.ClassNotFoundException - if the class could not be found.
See Also:
"The Java Virtual Machine Specification, section 4.3.2"

primitiveClassForName

public static final java.lang.Class primitiveClassForName(java.lang.String dotSignature)
Retrieves the class object representing a primitive type.

Parameters:
dotSignature - a one-character string containing a type descriptor character for a primitive type.
Returns:
the class representation of a primitive type, or null if dotSignature does not contain a descriptor for a primitive type.
See Also:
SIGS

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.