public class JavaEscapeUtils extends Object
JavaEscapeUtils provides useful methods for escaping or transforming invalid Java tokens to valid ones that could be used in
generated Java source code.| Constructor and Description |
|---|
JavaEscapeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isJavaKeyword(String key)
Test whether the argument is a Java keyword.
|
static String |
makeJavaIdentifier(String identifier)
Converts the given identifier to a legal Java identifier
|
static String |
makeJavaPackage(String scriptName)
Converts the given scriptName to a Java package or fully-qualified class name
|
static String |
mangleChar(char ch)
Mangle the specified character to create a legal Java class name.
|
static char |
unmangle(String mangled)
Provided a mangled string (obtained by calling
mangleChar(char)) it will will return the character that was mangled. |
public static String makeJavaIdentifier(String identifier)
identifier - the identifier to convertpublic static String mangleChar(char ch)
ch - the character to manglepublic static char unmangle(String mangled)
mangleChar(char)) it will will return the character that was mangled.mangled - the mangled stringpublic static String makeJavaPackage(String scriptName)
scriptName - the scriptName to convertpublic static boolean isJavaKeyword(String key)
key - the String to testtrue if the String is a Java keyword, false otherwiseCopyright © 2017 The Apache Software Foundation. All rights reserved.