Class IDLNameTranslatorImpl
java.lang.Object
com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl
- All Implemented Interfaces:
IDLNameTranslator
Bidirectional translator between RMI-IIOP interface methods and
and IDL Names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Internal helper class for tracking information related to each interface method while we're building the name translation table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String[]
private static final String
private static char[]
private static final String
private static String[]
private static final String
private Class[]
private static final String
private static final String
private Method[]
private static final String
private static final String
private static final String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
IDLNameTranslatorImpl
(Class<?>[] interfaces) Initialize an IDLNameTranslator for the given interface. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
static String
charToUnicodeRepresentation
(char c) Returns Unicode mangling as defined in Section 1.3.2.4 of Java2IDL spec.private static IDLType
classToIDLType
(Class<?> c) static IDLNameTranslator
Return an IDLNameTranslator for the given interface.static IDLNameTranslator
Return an IDLNameTranslator for the given interfaces.static String
getExceptionId
(Class cls) getIDLName
(Method method) Get the mangled name that corresponds to the given method on this IDLNameTranslator's interface.Class[]
Get the interfaces that this IDLNameTranslator describes.private static String
getMappedContainerName
(Class<?> c) Get the method from this IDLNameTranslator's interfaces that corresponds to the mangled name idlName.Method[]
Get all methods for this remote interface.private static String
getPackageName
(Class<?> c) Return Class' package name or null if there is no package.private static String
Return portion of class name excluding package name.private static boolean
hasLeadingUnderscore
(String identifier) Checks whether a java identifier starts with an underscore.private static boolean
identifierClashesWithContainer
(String mappedContainerName, String identifier) Implements Section 1.3.2.9 of Java2IDL Mapping.private static boolean
isIDLAlphabeticChar
(char c) True if character is one of 114 Alphabetic characters as specified in Table 2 of Chapter 3 in CORBA spec.private static boolean
isIDLDecimalDigit
(char c) True if character is one of 10 Decimal Digits specified in Table 3 of Chapter 3 in CORBA spec.private static boolean
isIDLIdentifier
(String identifier) private static boolean
isIDLIdentifierChar
(char c) (package private) static boolean
isIDLKeyword
(String identifier) Checks whether a java identifier clashes with an IDL keyword.private static boolean
isUnderscore
(char c) (package private) String
mangleCaseSensitiveCollision
(String identifier) Implements mangling portion of Section 1.3.2.7 of Java2IDL spec.private static String
mangleContainerClash
(String identifier) private static String
mangleIdentifier
(String identifier) Perform all necessary stand-alone identifier mangling operations on a java identifier that is being transformed into an IDL name.private static String
mangleIdentifier
(String identifier, boolean attribute) (package private) static String
mangleIDLKeywordClash
(String identifier) private static String
mangleLeadingUnderscore
(String identifier) private static String
mangleOverloadedMethod
(String mangledName, Method m) Mangle an overloaded method name as defined in Section 1.3.2.6 of Java2IDL spec.(package private) static String
mangleUnicodeChars
(String identifier) Implements Section 1.3.2.4 of Java2IDL Mapping.toString()
-
Field Details
-
IDL_KEYWORDS
-
HEX_DIGITS
private static char[] HEX_DIGITS -
UNDERSCORE
- See Also:
-
INNER_CLASS_SEPARATOR
- See Also:
-
BASE_IDL_ARRAY_MODULE_TYPE
-
BASE_IDL_ARRAY_ELEMENT_TYPE
- See Also:
-
LEADING_UNDERSCORE_CHAR
- See Also:
-
ID_CONTAINER_CLASH_CHAR
- See Also:
-
OVERLOADED_TYPE_SEPARATOR
- See Also:
-
ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS
- See Also:
-
GET_ATTRIBUTE_PREFIX
- See Also:
-
SET_ATTRIBUTE_PREFIX
- See Also:
-
IS_ATTRIBUTE_PREFIX
- See Also:
-
idlKeywords_
-
interf_
-
methodToIDLNameMap_
-
IDLNameToMethodMap_
-
methods_
-
-
Constructor Details
-
IDLNameTranslatorImpl
Initialize an IDLNameTranslator for the given interface.- Throws:
IllegalStateException
- if given class is not a valid RMI/IIOP Remote Interface
-
-
Method Details
-
get
Return an IDLNameTranslator for the given interface.- Parameters:
interf
- Interface to get translator for.- Returns:
- IDLNameTranslator for specified interface.
- Throws:
IllegalStateException
- if given class is not a valid RMI/IIOP Remote Interface
-
get
Return an IDLNameTranslator for the given interfaces.- Parameters:
interfaces
- Interfaces to get a translator for- Returns:
- IDLNameTranslator for specified interfaces.
- Throws:
IllegalStateException
- if given classes are not valid RMI/IIOP Remote Interfaces
-
getExceptionId
-
getInterfaces
Description copied from interface:IDLNameTranslator
Get the interfaces that this IDLNameTranslator describes.- Specified by:
getInterfaces
in interfaceIDLNameTranslator
- Returns:
- interfaces described
-
getMethods
Description copied from interface:IDLNameTranslator
Get all methods for this remote interface. The methods are returned in a canonical order, that is, they are always in the same order for a particular interface.- Specified by:
getMethods
in interfaceIDLNameTranslator
- Returns:
- methods for interface
-
getMethod
Description copied from interface:IDLNameTranslator
Get the method from this IDLNameTranslator's interfaces that corresponds to the mangled name idlName. Returns null if there is no matching method.- Specified by:
getMethod
in interfaceIDLNameTranslator
- Parameters:
idlName
- name of method- Returns:
- method with the specified name
-
getIDLName
Description copied from interface:IDLNameTranslator
Get the mangled name that corresponds to the given method on this IDLNameTranslator's interface. Returns null if there is no matching name.- Specified by:
getIDLName
in interfaceIDLNameTranslator
- Parameters:
method
- method to get name of- Returns:
- the corresponding name
-
buildNameTranslation
private void buildNameTranslation() -
mangleIdentifier
Perform all necessary stand-alone identifier mangling operations on a java identifier that is being transformed into an IDL name. That is, mangling operations that don't require looking at anything else but the identifier itself. This covers sections 1.3.2.2, 1.3.2.3, and 1.3.2.4 of the Java2IDL spec. Method overloading and case-sensitivity checks are handled elsewhere. -
mangleIdentifier
-
isIDLKeyword
Checks whether a java identifier clashes with an IDL keyword. Note that this is a case-insensitive comparison. Used to implement section 1.3.2.2 of Java2IDL spec. -
mangleIDLKeywordClash
-
mangleLeadingUnderscore
-
hasLeadingUnderscore
Checks whether a java identifier starts with an underscore. Used to implement section 1.3.2.3 of Java2IDL spec. -
mangleUnicodeChars
Implements Section 1.3.2.4 of Java2IDL Mapping. All non-IDL identifier characters must be replaced with their Unicode representation. -
mangleCaseSensitiveCollision
Implements mangling portion of Section 1.3.2.7 of Java2IDL spec. This method only deals with the actual mangling. Decision about whether case-sensitive collision mangling is required is made elsewhere. "...a mangled name is generated consisting of the original name followed by an underscore separated list of decimal indices into the string, where the indices identify all the upper case characters in the original string. Indices are zero based." -
mangleContainerClash
-
identifierClashesWithContainer
private static boolean identifierClashesWithContainer(String mappedContainerName, String identifier) Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this context means the name of the java Class(excluding package) in which the identifier is defined. Comparison is case-insensitive. -
charToUnicodeRepresentation
Returns Unicode mangling as defined in Section 1.3.2.4 of Java2IDL spec. "For Java identifiers that contain illegal OMG IDL identifier characters such as '$' or Unicode characters outside of ISO Latin 1, any such illegal characters are replaced by "U" followed by the 4 hexadecimal characters(in upper case) representing the Unicode value. So, the Java name a$b is mapped to aU0024b and xμy is mapped to xU03BCy."- Parameters:
c
- character to convert- Returns:
- Unicode String
-
isIDLIdentifier
-
isIDLIdentifierChar
private static boolean isIDLIdentifierChar(char c) -
isIDLAlphabeticChar
private static boolean isIDLAlphabeticChar(char c) True if character is one of 114 Alphabetic characters as specified in Table 2 of Chapter 3 in CORBA spec. -
isIDLDecimalDigit
private static boolean isIDLDecimalDigit(char c) True if character is one of 10 Decimal Digits specified in Table 3 of Chapter 3 in CORBA spec. -
isUnderscore
private static boolean isUnderscore(char c) -
mangleOverloadedMethod
Mangle an overloaded method name as defined in Section 1.3.2.6 of Java2IDL spec. Current value of method name is passed in as argument. We can't start from original method name since the name might have been partially mangled as a result of the other rules. -
classToIDLType
-
getPackageName
Return Class' package name or null if there is no package. -
getMappedContainerName
-
getUnmappedContainerName
Return portion of class name excluding package name. -
toString
-