public static String canonicalize(final String name, final String prefix) {

        // If even one logical word grouping cannot be found, default to
        // simply converting the string to uppercase and adding the
        // prefix
        Matcher groupMatcher = STRING_NAME_GROUPING.matcher(name);
        if (!groupMatcher.find())
            return prefix + name.toUpperCase();

        // Split the given name into logical word groups, separated by
        // underscores and converted to uppercase
        StringBuilder builder = new StringBuilder(prefix);
        builder.append(groupMatcher.group(0).toUpperCase());

        while (groupMatcher.find()) {
            builder.append("_");
            builder.append(groupMatcher.group(0).toUpperCase());
        }

        return builder.toString();

    }
Generates the name of the parameter token that should be populated with
the given string. The provided string will be automatically transformed
from "CamelCase", "headlessCamelCase", "lowercase_with_underscores",
and "mixes_ofBoth_Styles" to consistent "UPPERCASE_WITH_UNDERSCORES".
Each returned token name will be prefixed with the string value provided
in the prefix.  The value provided in prefix will be prepended to the
string, but will itself not be transformed.

@param name
    The string to be used to generate the token name.

@param prefix
    The prefix to prepend to the generated token name.

@return
    The name of the parameter token that should be populated with the
    given string.
guacamole-ext/src/main/java/org/apache/guacamole/token/TokenName.java