Package alpine.json
Class TrimmedStringDeserializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonDeserializer<String>
-
- alpine.json.TrimmedStringDeserializer
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider
public class TrimmedStringDeserializer extends com.fasterxml.jackson.databind.JsonDeserializer<String>
This custom deserializer ensures that empty strings are deserialized as null rather than an "". Usage example:@JsonDeserialize(using = TrimmedStringDeserializer.class) String name;
- Since:
- 1.0.0
- Author:
- Steve Springett
-
-
Constructor Summary
Constructors Constructor Description TrimmedStringDeserializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdeserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext context)-
Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, deserializeWithType, findBackReference, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
-
-
-
-
Method Detail
-
deserialize
public String deserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext context) throws IOException
- Specified by:
deserializein classcom.fasterxml.jackson.databind.JsonDeserializer<String>- Throws:
IOException
-
-