程序包 com.sh.json.util
类 JavaIdentifierTransformer
java.lang.Object
com.sh.json.util.JavaIdentifierTransformer
Transforms a string into a valid Java identifier.
There are five predefined strategies:
There are five predefined strategies:
- NOOP: does not perform transformation.
- CAMEL_CASE: follows the camel case convention, deletes non JavaIndentifierPart chars.
- UNDERSCORE: transform whitespace and non JavaIdentifierPart chars to '_'.
- WHITESPACE: deletes whitespace and non JavaIdentifierPart chars.
- STRICT: always throws a JSONException, does not perform transformation.
-
字段概要
字段修饰符和类型字段说明static final JavaIdentifierTransformerCamelCase transformer 'camel case' => 'camelCase'static final JavaIdentifierTransformerNoop transformer '@invalid' => '@invalid'static final JavaIdentifierTransformerStrict transformer '@invalid' => JSONExceptionstatic final JavaIdentifierTransformerUnderscore transformer 'under score' => 'under_score'static final JavaIdentifierTransformerWhitespace transformer 'white space' => 'whitespace' -
构造器概要
构造器 -
方法概要
-
字段详细资料
-
CAMEL_CASE
CamelCase transformer 'camel case' => 'camelCase' -
NOOP
Noop transformer '@invalid' => '@invalid' -
STRICT
Strict transformer '@invalid' => JSONException -
UNDERSCORE
Underscore transformer 'under score' => 'under_score' -
WHITESPACE
Whitespace transformer 'white space' => 'whitespace'
-
-
构造器详细资料
-
JavaIdentifierTransformer
public JavaIdentifierTransformer()
-
-
方法详细资料
-
transformToJavaIdentifier
-
shaveOffNonJavaIdentifierStartChars
Removes all non JavaIdentifier chars from the start of the string.- 抛出:
JSONException- if the resulting string has zero length.
-