JsonSerializationContext (Gson 2.3.1 API)
Date: 2014-11-20

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gson
Interface JsonSerializationContext

    public interface JsonSerializationContext

Context for serialization that is passed to a custom serializer during invocation of its `JsonSerializer.serialize(Object, Type, JsonSerializationContext)` method.

Author:
  Inderjeet Singh, Joel Leitch

Method Summary
`JsonElement` | `serialize(Object src)` Invokes default serialization on the specified object.
`JsonElement` | `serialize(Object src, Type typeOfSrc)` Invokes default serialization on the specified object passing the specific type information.

Method Detail

### serialize

    JsonElement serialize(Object src)

  Invokes default serialization on the specified object.

  Parameters:
    `src` - the object that needs to be serialized.
  Returns:
    a tree of `JsonElement`s corresponding to the serialized form of `src`.

### serialize

    JsonElement serialize(Object src,
                          Type typeOfSrc)

  Invokes default serialization on the specified object passing the specific type information. It should never be invoked on the element received as a parameter of the `JsonSerializer.serialize(Object, Type, JsonSerializationContext)` method. Doing so will result in an infinite loop since Gson will in-turn call the custom serializer again.

  Parameters:
    `src` - the object that needs to be serialized.
    `typeOfSrc` - the actual genericized type of src object.
  Returns:
    a tree of `JsonElement`s corresponding to the serialized form of `src`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008–2014 Google, Inc.. All rights reserved.