src/main/java/org/jmxtrans/agent/ResultNameStrategyImpl.java
protected String escapeObjectName(@Nonnull ObjectName objectName) {
        StringBuilder result = new StringBuilder();
        StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getDomain(), result);
        result.append('.');
        List<String> keys = Collections.list(objectName.getKeyPropertyList().keys());
        Collections.sort(keys);
        for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
            String key = it.next();
            StringUtils2.appendEscapedNonAlphaNumericChars(key, result);
            result.append("__");
            StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getKeyProperty(key), result);
            if (it.hasNext()) {
                result.append('.');
            }
        }
        if (logger.isLoggable(Level.FINEST))
            logger.log(Level.FINEST, "escapeObjectName(" + objectName + "): " + result);
        return result.toString();
    }
protected String escapeObjectName(@Nonnull ObjectName objectName) {
        StringBuilder result = new StringBuilder();
        StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getDomain(), result);
        result.append('.');
        List<String> keys = Collections.list(objectName.getKeyPropertyList().keys());
        Collections.sort(keys);
        for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
            String key = it.next();
            StringUtils2.appendEscapedNonAlphaNumericChars(key, result);
            result.append("__");
            StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getKeyProperty(key), result);
            if (it.hasNext()) {
                result.append('.');
            }
        }
        if (logger.isLoggable(Level.FINEST))
            logger.log(Level.FINEST, "escapeObjectName(" + objectName + "): " + result);
        return result.toString();
    }
protected String escapeObjectName ( @ Nonnull ObjectName objectName ) { StringBuilder result = new StringBuilder ( ) ; StringUtils2 . appendEscapedNonAlphaNumericChars ( objectName . getDomain ( ) , result ) ; result . append ( ' ' ) ; List < String > keys = Collections . list ( objectName . getKeyPropertyList ( ) . keys ( ) ) ; Collections . sort ( keys ) ; for ( Iterator < String > it = keys . iterator ( ) ; it . hasNext ( ) ; ) { String key = it . next ( ) ; StringUtils2 . appendEscapedNonAlphaNumericChars ( key , result ) ; result . append ( "__" ) ; StringUtils2 . appendEscapedNonAlphaNumericChars ( objectName . getKeyProperty ( key ) , result ) ; if ( it . hasNext ( ) ) { result . append ( ' ' ) ; } } if ( logger . isLoggable ( Level . FINEST ) ) logger . log ( Level . FINEST , "escapeObjectName(" + objectName + "): " + result ) ; return result . toString ( ) ; }
Transforms an {@linkplain javax.management.ObjectName} into a plain {@linkplain String} only composed of ('a' to 'Z', 'A' to 'Z', '_').

'_' is the escape char for not compliant chars.
Transforms an { @linkplain javax . management . ObjectName } into a plain { @linkplain String } only composed of ( a to Z A to Z _ ) .