public enum

LongSerializationPolicy

extends Enum<E extends Enum<E>>
java.lang.Object
   ↳ java.lang.Enum<E extends java.lang.Enum<E>>
     ↳ com.google.gson.LongSerializationPolicy

Class Overview

Defines the expected format for a long or Long type when its serialized.

Summary

Enum Values
LongSerializationPolicy  DEFAULT  This is the "default" serialization policy that will output a long object as a JSON number. 
LongSerializationPolicy  STRING  Serializes a long value as a quoted string. 
Public Methods
abstract JsonElement serialize(Long value)
Serialize this value using this serialization policy.
static LongSerializationPolicy valueOf(String name)
final static LongSerializationPolicy[] values()
[Expand]
Inherited Methods
From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum Values

public static final LongSerializationPolicy DEFAULT

This is the "default" serialization policy that will output a 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

Serializes a long value as a quoted string. For example, assume an object has a long field named "f" then the serialized output would be: {"f":"123"}.

Public Methods

public abstract JsonElement serialize (Long value)

Serialize this value using this serialization policy.

Parameters
value the long value to be serialized into a JsonElement
Returns
  • the serialized version of value

public static LongSerializationPolicy valueOf (String name)

public static final LongSerializationPolicy[] values ()