public class JavaEscapeUtils
extends java.lang.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(java.lang.String key)
Test whether the argument is a Java keyword.
|
static java.lang.String |
makeJavaIdentifier(java.lang.String identifier)
Converts the given identifier to a legal Java identifier
|
static java.lang.String |
makeJavaPackage(java.lang.String scriptName)
Converts the given scriptName to a Java package or fully-qualified class name
|
static java.lang.String |
mangleChar(char ch)
Mangle the specified character to create a legal Java class name.
|
static char |
unmangle(java.lang.String mangled)
Provided a mangled string (obtained by calling
mangleChar(char) ) it will will return the character that was mangled. |
public static java.lang.String makeJavaIdentifier(java.lang.String identifier)
identifier
- the identifier to convertpublic static java.lang.String mangleChar(char ch)
ch
- the character to manglepublic static char unmangle(java.lang.String mangled)
mangleChar(char)
) it will will return the character that was mangled.mangled
- the mangled stringpublic static java.lang.String makeJavaPackage(java.lang.String scriptName)
scriptName
- the scriptName to convertpublic static boolean isJavaKeyword(java.lang.String key)
key
- the String to testtrue
if the String is a Java keyword, false
otherwiseCopyright © 2018 The Apache Software Foundation. All rights reserved.