Public 属性 | |
| IDENTITY | |
| UPPER_CAMEL_CASE | |
| UPPER_CAMEL_CASE_WITH_SPACES | |
| LOWER_CASE_WITH_UNDERSCORES | |
| LOWER_CASE_WITH_DASHES | |
静态 Private 成员函数 | |
| static String | separateCamelCase (String name, String separator) |
| static String | upperCaseFirstLetter (String name) |
| static String | modifyString (char firstCharacter, String srcString, int indexOfSubstring) |
额外继承的成员函数 | |
Public 成员函数 继承自 com.google.gson.FieldNamingStrategy | |
| String | translateName (Field f) |
An enumeration that defines a few standard naming conventions for JSON field names. This enumeration should be used in conjunction with com.google.gson.GsonBuilder to configure a com.google.gson.Gson instance to properly translate Java field names into the desired JSON field names.
|
inlinestaticprivate |
|
inlinestaticprivate |
Converts the field name that uses camel-case define word separation into separate words that are separated by the provided
.
|
inlinestaticprivate |
Ensures the JSON field names begins with an upper case letter.
| com.google.gson.FieldNamingPolicy.IDENTITY |
Using this naming policy with Gson will ensure that the field name is unchanged.
| com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_DASHES |
Using this naming policy with Gson will modify the Java Field name from its camel cased form to a lower case field name where each word is separated by a dash (-).
Here's a few examples of the form "Java Field Name" —> "JSON Field Name":
Using dashes in JavaScript is not recommended since dash is also used for a minus sign in expressions. This requires that a field named with dashes is always accessed as a quoted property like
. Accessing it as an object field
will result in an unintended javascript expression.
| com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES |
Using this naming policy with Gson will modify the Java Field name from its camel cased form to a lower case field name where each word is separated by an underscore (_).
Here's a few examples of the form "Java Field Name" —> "JSON Field Name":
| com.google.gson.FieldNamingPolicy.UPPER_CAMEL_CASE |
Using this naming policy with Gson will ensure that the first "letter" of the Java field name is capitalized when serialized to its JSON form.
Here's a few examples of the form "Java Field Name" —> "JSON Field Name":
| com.google.gson.FieldNamingPolicy.UPPER_CAMEL_CASE_WITH_SPACES |
Using this naming policy with Gson will ensure that the first "letter" of the Java field name is capitalized when serialized to its JSON form and the words will be separated by a space.
Here's a few examples of the form "Java Field Name" —> "JSON Field Name":
1.8.8