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 deserialization that is passed to a custom deserializer during invocation of its
23 * {@link JsonDeserializer#deserialize(JsonElement, Type, JsonDeserializationContext)}
26 * @author Inderjeet Singh
29 public interface JsonDeserializationContext
{
32 * Invokes default deserialization on the specified object. It should never be invoked on
33 * the element received as a parameter of the
34 * {@link JsonDeserializer#deserialize(JsonElement, Type, JsonDeserializationContext)} method. Doing
35 * so will result in an infinite loop since Gson will in-turn call the custom deserializer again.
37 * @param json the parse tree.
38 * @param typeOfT type of the expected return value.
39 * @param <T> The type of the deserialized object.
40 * @return An object of type typeOfT.
41 * @throws JsonParseException if the parse tree does not contain expected data.
43 public <T
> T
deserialize(JsonElement json
, Type typeOfT
) throws JsonParseException
;