public static String fromAttribute ( String name ) { // If even one logical word grouping cannot be found, default to // simply converting the attribute to uppercase and adding the // prefix Matcher groupMatcher = LDAP_ATTRIBUTE_NAME_GROUPING . matcher ( name ) ; if ( ! groupMatcher . find ( ) ) return LDAP_ATTRIBUTE_TOKEN_PREFIX + name . toUpperCase ( ) ; // Split the given name into logical word groups, separated by // underscores and converted to uppercase StringBuilder builder = new StringBuilder ( LDAP_ATTRIBUTE_TOKEN_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 value of the given LDAP attribute . The name of the LDAP attribute will automatically be transformed from CamelCase headlessCamelCase lowercase_with_underscores and mixes_ofBoth_Styles to consistent UPPERCASE_WITH_UNDERSCORES . Each returned attribute will be prefixed with LDAP_ .