iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/rmi/Util.java
public static String javaToIDLName(String name) {
        if (name == null || "".equals(name) || name.indexOf('.') != -1)
            throw IIOPLogger.ROOT_LOGGER.nameCannotBeNullEmptyOrQualified();

        StringBuffer res = new StringBuffer(name.length());

        if (name.charAt(0) == '_')
            res.append('J'); // 1.3.2.3

        for (int i = 0; i < name.length(); ++i) {
            char c = name.charAt(i);

            if (isLegalIDLIdentifierChar(c))
                res.append(c);
            else // 1.3.2.4
                res.append('U').append(toHexString((int) c));
        }

        String s = res.toString();

        if (isReservedIDLKeyword(s))
            return "_" + s;
        else
            return s;
    }
public static String javaToIDLName(String name) {
        if (name == null || "".equals(name) || name.indexOf('.') != -1)
            throw IIOPLogger.ROOT_LOGGER.nameCannotBeNullEmptyOrQualified();

        StringBuffer res = new StringBuffer(name.length());

        if (name.charAt(0) == '_')
            res.append('J'); // 1.3.2.3

        for (int i = 0; i < name.length(); ++i) {
            char c = name.charAt(i);

            if (isLegalIDLIdentifierChar(c))
                res.append(c);
            else // 1.3.2.4
                res.append('U').append(toHexString((int) c));
        }

        String s = res.toString();

        if (isReservedIDLKeyword(s))
            return "_" + s;
        else
            return s;
    }
public static String javaToIDLName ( String name ) { if ( name == null || "" . equals ( name ) || name . indexOf ( ' ' ) != - 1 ) throw IIOPLogger . ROOT_LOGGER . nameCannotBeNullEmptyOrQualified ( ) ; StringBuffer res = new StringBuffer ( name . length ( ) ) ; if ( name . charAt ( 0 ) == ' ' ) res . append ( ' ' ) ; // 1.3.2.3 for ( int i = 0 ; i < name . length ( ) ; ++ i ) { char c = name . charAt ( i ) ; if ( isLegalIDLIdentifierChar ( c ) ) res . append ( c ) ; else // 1.3.2.4 res . append ( ' ' ) . append ( toHexString ( ( int ) c ) ) ; } String s = res . toString ( ) ; if ( isReservedIDLKeyword ( s ) ) return "_" + s ; else return s ; }
Map Java name to IDL name, as per sections 1.3.2.3, 1.3.2.4 and
1.3.2.2.
This only works for a single name component, without a qualifying
dot.
Map Java name to IDL name as per sections 1 . 3 . 2 . 3 1 . 3 . 2 . 4 and 1 . 3 . 2 . 2 . This only works for a single name component without a qualifying dot .