Interface representing a custom deserializer for JSON. You should write a custom deserializer, if you are not happy with the default deserialization done by Gson. You will also need to register this deserializer through {@link GsonBuilder#registerTypeAdapter(Type, Object)}. <p>Let us look at exampl
| 74 | * deserializer may be asked to deserialize a specific generic type of the T. |
| 75 | */ |
| 76 | public interface JsonDeserializer<T> { |
| 77 | |
| 78 | /** |
| 79 | * Gson invokes this call-back method during deserialization when it encounters a field of the |
| 80 | * specified type. |
| 81 | * |
| 82 | * <p>In the implementation of this call-back method, you should consider invoking {@link |
| 83 | * JsonDeserializationContext#deserialize(JsonElement, Type)} method to create objects for any |
| 84 | * non-trivial field of the returned object. However, you should never invoke it on the same type |
| 85 | * passing {@code json} since that will cause an infinite loop (Gson will call your call-back |
| 86 | * method again). |
| 87 | * |
| 88 | * @param json The Json data being deserialized |
| 89 | * @param typeOfT The type of the Object to deserialize to |
| 90 | * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} |
| 91 | * @throws JsonParseException if json is not in the expected format of {@code typeOfT} |
| 92 | */ |
| 93 | T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) |
| 94 | throws JsonParseException; |
| 95 | } |
no outgoing calls
no test coverage detected