|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<LongSerializationPolicy> com.google.gson.LongSerializationPolicy
public enum LongSerializationPolicy
Defines the expected format for a long
or Long
type when its serialized.
Enum Constant Summary | |
---|---|
DEFAULT
This is the "default" serialization policy that will output a long object as a JSON
number. |
|
STRING
Serializes a long value as a quoted string. |
Method Summary | |
---|---|
abstract JsonElement |
serialize(Long value)
Serialize this value using this serialization policy. |
static LongSerializationPolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static LongSerializationPolicy[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final LongSerializationPolicy DEFAULT
long
object as a JSON
number. For example, assume an object has a long field named "f" then the serialized output
would be:
{"f":123}
.
public static final LongSerializationPolicy STRING
{"f":"123"}
.
Method Detail |
---|
public static LongSerializationPolicy[] values()
for (LongSerializationPolicy c : LongSerializationPolicy.values()) System.out.println(c);
public static LongSerializationPolicy valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic abstract JsonElement serialize(Long value)
value
using this serialization policy.
value
- the long value to be serialized into a JsonElement
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |