Package org.dominokit.jacksonapt
Class JsonDeserializer<T>
java.lang.Object
org.dominokit.jacksonapt.JsonDeserializer<T>
- Direct Known Subclasses:
AbstractArray2dJsonDeserializer,AbstractArrayJsonDeserializer,AbstractBeanJsonDeserializer,BaseDateJsonDeserializer,BaseIterableJsonDeserializer,BaseMapJsonDeserializer,BaseNumberJsonDeserializer,BooleanJsonDeserializer,CharacterJsonDeserializer,EnumJsonDeserializer,StringJsonDeserializer,UUIDJsonDeserializer,VoidJsonDeserializer
public abstract class JsonDeserializer<T>
extends java.lang.Object
Base class for all the deserializer. It handles null values and exceptions. The rest is delegated to implementations.
- Version:
- $Id: $
- Author:
- Nicolas Morel
-
Constructor Summary
Constructors Constructor Description JsonDeserializer() -
Method Summary
Modifier and Type Method Description Tdeserialize(JsonReader reader, JsonDeserializationContext ctx)Deserializes a JSON input into an object.Tdeserialize(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params)Deserializes a JSON input into an object.protected TdeserializeNullValue(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params)Deserialize the null value.protected abstract TdoDeserialize(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params)Deserializes a non-null JSON input into an object.voidsetBackReference(java.lang.String referenceName, java.lang.Object reference, T value, JsonDeserializationContext ctx)Set the back reference.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JsonDeserializer
public JsonDeserializer()
-
-
Method Details
-
deserialize
public T deserialize(JsonReader reader, JsonDeserializationContext ctx) throws JsonDeserializationExceptionDeserializes a JSON input into an object.- Parameters:
reader-JsonReaderused to read the JSON inputctx- Context for the full deserialization process- Returns:
- the deserialized object
- Throws:
JsonDeserializationException- if an error occurs during the deserialization
-
deserialize
public T deserialize(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params) throws JsonDeserializationExceptionDeserializes a JSON input into an object.- Parameters:
reader-JsonReaderused to read the JSON inputctx- Context for the full deserialization processparams- Parameters for this deserialization- Returns:
- the deserialized object
- Throws:
JsonDeserializationException- if an error occurs during the deserialization
-
deserializeNullValue
protected T deserializeNullValue(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params)Deserialize the null value. This method allows children to override the default behaviour.- Parameters:
reader-JsonReaderused to read the JSON inputctx- Context for the full deserialization processparams- Parameters for this deserialization- Returns:
- the deserialized object
-
doDeserialize
protected abstract T doDeserialize(JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params)Deserializes a non-null JSON input into an object.- Parameters:
reader-JsonReaderused to read the JSON inputctx- Context for the full deserialization processparams- Parameters for this deserialization- Returns:
- the deserialized object
-
setBackReference
public void setBackReference(java.lang.String referenceName, java.lang.Object reference, T value, JsonDeserializationContext ctx)Set the back reference.- Parameters:
referenceName- name of the referencereference- reference to setvalue- value to set the reference to.ctx- Context for the full deserialization process
-