Class IDLNameTranslatorImpl

java.lang.Object
com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl
All Implemented Interfaces:
IDLNameTranslator

public class IDLNameTranslatorImpl extends Object implements IDLNameTranslator
Bidirectional translator between RMI-IIOP interface methods and and IDL Names.
  • Field Details

  • Constructor Details

    • IDLNameTranslatorImpl

      private IDLNameTranslatorImpl(Class<?>[] interfaces)
      Initialize an IDLNameTranslator for the given interface.
      Throws:
      IllegalStateException - if given class is not a valid RMI/IIOP Remote Interface
  • Method Details

    • get

      public static IDLNameTranslator get(Class interf)
      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

      public static IDLNameTranslator get(Class[] interfaces)
      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

      public static String getExceptionId(Class cls)
    • getInterfaces

      public Class[] getInterfaces()
      Description copied from interface: IDLNameTranslator
      Get the interfaces that this IDLNameTranslator describes.
      Specified by:
      getInterfaces in interface IDLNameTranslator
      Returns:
      interfaces described
    • getMethods

      public Method[] 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 interface IDLNameTranslator
      Returns:
      methods for interface
    • getMethod

      public Method getMethod(String idlName)
      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 interface IDLNameTranslator
      Parameters:
      idlName - name of method
      Returns:
      method with the specified name
    • getIDLName

      public String getIDLName(Method method)
      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 interface IDLNameTranslator
      Parameters:
      method - method to get name of
      Returns:
      the corresponding name
    • buildNameTranslation

      private void buildNameTranslation()
    • mangleIdentifier

      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. 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

      private static String mangleIdentifier(String identifier, boolean attribute)
    • isIDLKeyword

      static boolean isIDLKeyword(String identifier)
      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

      static String mangleIDLKeywordClash(String identifier)
    • mangleLeadingUnderscore

      private static String mangleLeadingUnderscore(String identifier)
    • hasLeadingUnderscore

      private static boolean hasLeadingUnderscore(String identifier)
      Checks whether a java identifier starts with an underscore. Used to implement section 1.3.2.3 of Java2IDL spec.
    • mangleUnicodeChars

      static String mangleUnicodeChars(String identifier)
      Implements Section 1.3.2.4 of Java2IDL Mapping. All non-IDL identifier characters must be replaced with their Unicode representation.
    • mangleCaseSensitiveCollision

      String mangleCaseSensitiveCollision(String identifier)
      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

      private static String mangleContainerClash(String identifier)
    • 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

      public static String charToUnicodeRepresentation(char c)
      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

      private static boolean isIDLIdentifier(String identifier)
    • 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

      private static String mangleOverloadedMethod(String mangledName, Method m)
      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

      private static IDLType classToIDLType(Class<?> c)
    • getPackageName

      private static String getPackageName(Class<?> c)
      Return Class' package name or null if there is no package.
    • getMappedContainerName

      private static String getMappedContainerName(Class<?> c)
    • getUnmappedContainerName

      private static String getUnmappedContainerName(Class<?> c)
      Return portion of class name excluding package name.
    • toString

      public String toString()
      Overrides:
      toString in class Object