程序包 com.sh.json.util

类 JavaIdentifierTransformer

java.lang.Object
com.sh.json.util.JavaIdentifierTransformer

public abstract class JavaIdentifierTransformer extends Object
Transforms a string into a valid Java identifier.
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.
  • 字段详细资料

  • 构造器详细资料

    • JavaIdentifierTransformer

      public JavaIdentifierTransformer()
  • 方法详细资料

    • transformToJavaIdentifier

      public abstract String transformToJavaIdentifier(String str)
    • shaveOffNonJavaIdentifierStartChars

      protected final String shaveOffNonJavaIdentifierStartChars(String str)
      Removes all non JavaIdentifier chars from the start of the string.
      抛出:
      JSONException - if the resulting string has zero length.