updated JsonDeserializer example (#2192)
* fixed json deserializer example * correcting the json * updated per review * updated per review * updated per review
This commit is contained in:
parent
847d7f6638
commit
a733150cfa
@ -48,10 +48,12 @@ import java.lang.reflect.Type;
|
|||||||
* deserializer:</p>
|
* deserializer:</p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* class IdDeserializer implements JsonDeserializer<Id>() {
|
* class IdDeserializer implements JsonDeserializer<Id> {
|
||||||
* public Id deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
|
* public Id deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
|
||||||
* throws JsonParseException {
|
* throws JsonParseException {
|
||||||
* return new Id((Class)typeOfT, id.getValue());
|
* long idValue = json.getAsJsonPrimitive().getAsLong();
|
||||||
|
* return new Id((Class) typeOfT, idValue);
|
||||||
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,7 @@ import java.lang.reflect.Type;
|
|||||||
* serializer:</p>
|
* serializer:</p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* class IdSerializer implements JsonSerializer<Id>() {
|
* class IdSerializer implements JsonSerializer<Id> {
|
||||||
* public JsonElement serialize(Id id, Type typeOfId, JsonSerializationContext context) {
|
* public JsonElement serialize(Id id, Type typeOfId, JsonSerializationContext context) {
|
||||||
* return new JsonPrimitive(id.getValue());
|
* return new JsonPrimitive(id.getValue());
|
||||||
* }
|
* }
|
||||||
|
Loading…
Reference in New Issue
Block a user