]>
iEval git - unical.git/blob - JsonSerializationContext.java
ca3ec4f901669298b749aea11397c2686f5be569
2 * Copyright (C) 2008 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.google
.gson
;
19 import java
.lang
.reflect
.Type
;
22 * Context for serialization that is passed to a custom serializer during invocation of its
23 * {@link JsonSerializer#serialize(Object, Type, JsonSerializationContext)} method.
25 * @author Inderjeet Singh
28 public interface JsonSerializationContext
{
31 * Invokes default serialization on the specified object.
33 * @param src the object that needs to be serialized.
34 * @return a tree of {@link JsonElement}s corresponding to the serialized form of {@code src}.
36 public JsonElement
serialize(Object src
);
39 * Invokes default serialization on the specified object passing the specific type information.
40 * It should never be invoked on the element received as a parameter of the
41 * {@link JsonSerializer#serialize(Object, Type, JsonSerializationContext)} method. Doing
42 * so will result in an infinite loop since Gson will in-turn call the custom serializer again.
44 * @param src the object that needs to be serialized.
45 * @param typeOfSrc the actual genericized type of src object.
46 * @return a tree of {@link JsonElement}s corresponding to the serialized form of {@code src}.
48 public JsonElement
serialize(Object src
, Type typeOfSrc
);
This page took 0.045 seconds and 3 git commands to generate.