|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.json.util.JavaIdentifierTransformer
public abstract class JavaIdentifierTransformer
Transforms a string into a valid Java identifier.
There are five predefined strategies:
Field Summary | |
---|---|
static JavaIdentifierTransformer |
CAMEL_CASE
CamelCase transformer 'camel case' => 'camelCase' |
static JavaIdentifierTransformer |
NOOP
Noop transformer '@invalid' => '@invalid' |
static JavaIdentifierTransformer |
STRICT
Strict transformer '@invalid' => JSONException |
static JavaIdentifierTransformer |
UNDERSCORE
Underscore transformer 'under score' => 'under_score' |
static JavaIdentifierTransformer |
WHITESPACE
Whitespace transformer 'white space' => 'whitespace' |
Constructor Summary | |
---|---|
JavaIdentifierTransformer()
|
Method Summary | |
---|---|
protected String |
shaveOffNonJavaIdentifierStartChars(String str)
Removes all non JavaIdentifier chars from the start of the string. |
abstract String |
transformToJavaIdentifier(String str)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final JavaIdentifierTransformer CAMEL_CASE
public static final JavaIdentifierTransformer NOOP
public static final JavaIdentifierTransformer STRICT
public static final JavaIdentifierTransformer UNDERSCORE
public static final JavaIdentifierTransformer WHITESPACE
Constructor Detail |
---|
public JavaIdentifierTransformer()
Method Detail |
---|
public abstract String transformToJavaIdentifier(String str)
protected final String shaveOffNonJavaIdentifierStartChars(String str)
JSONException
- if the resulting string has zero length.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |