public class ConstantNameCreator extends CharReplacer
| Modifier and Type | Field and Description |
|---|---|
static String |
UPPER_CASE_SEPPARATION_PREFIX
The String which is usually used as prefix in front of upper case
characters in java constants.
|
JAVA_CLASSNAME_REPLACEMENT, JAVA_CLASSNAME_SPECIAL_CHARS| Constructor and Description |
|---|
ConstantNameCreator()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getUpperCaseSeparationPrefix()
Returns the prefix which is used as Separator when an upper
case character is encountered after a lower case character.
|
String |
process(String toProcess)
Replaces all characters in
toProcess which occur in
toReplace with toReplaceWith; groups of
special characters are treated as one. |
void |
setUpperCaseSeparationPrefix(String upperCaseSeparationPrefix)
Sets the prefix which is used as Separator when an upper
case character is encountered after a lower case character.
|
getToReplace, getToReplaceWith, setToReplace, setToReplaceWith, toStringpublic static final String UPPER_CASE_SEPPARATION_PREFIX
public String getUpperCaseSeparationPrefix()
public void setUpperCaseSeparationPrefix(String upperCaseSeparationPrefix)
upperCaseSeparationPrefix - the separator which is inserted
between a lower case character and an upper case character.public String process(String toProcess)
toProcess which occur in
toReplace with toReplaceWith; groups of
special characters are treated as one.
Inserts UPPER_CASE_SEPPARATION_PREFIX if an upper case
character follows a lower case character, and converts all charcters
to upper case.
If the string starts is empty or start with a number, the character toReplaceWith
is prefixed to the constant name.
Finally, the new String is returned.
Example: "prOceSS-*+ing~#._Test" is converted to "PR_OCE_SS_ING_TEST"
process in interface StringProcessorprocess in class CharReplacertoProcess - the String in which replacement should occur, not null.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.