Top Description Methods
com.google.gson

public Interface FieldNamingStrategy

Known Direct Implementers
com.google.gson.FieldNamingPolicy
Imports
com.google.gson.annotations.SerializedName, java.lang.reflect.Field, java.util.Collections, .List

A mechanism for providing custom field naming in Gson. This allows the client code to translate field names into a particular convention that is not supported as a normal Java field declaration rules. For example, Java does not support "-" characters in a field name.
Authors
Inderjeet Singh, Joel Leitch
Since
1.3

Method Summary

Modifier and TypeMethod and Description
public default List<String>

Returns:

the list of alternative field names.
alternateNames
(Field
the field object
f
)

Returns alternative names for this field when it is being deserialized.

public String

Returns:

the translated field name.
translateName
(Field
the field object that we are translating
f
)

Translates the field name into its JSON field name representation.

Method Detail

alternateNamesback to summary
public default List<String> alternateNames(Field f)

Returns alternative names for this field when it is being deserialized. This is similar to SerializedName#alternate().

Parameters
f:Field

the field object

Returns:List<String>

the list of alternative field names.

Since
2.13.1
translateNameback to summary
public String translateName(Field f)

Translates the field name into its JSON field name representation.

Parameters
f:Field

the field object that we are translating

Returns:String

the translated field name.

Since
1.3