Package tenapull.data.deserialize
Class MultiType.Serializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<MultiTypeWrapper>
tenapull.data.deserialize.MultiType.Serializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
- Enclosing class:
- MultiType
public static class MultiType.Serializer extends com.fasterxml.jackson.databind.JsonSerializer<MultiTypeWrapper>
Serializes a MultiTypeWrapper into the appropriate JSON primitive
-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description Serializer() -
Method Summary
Modifier and Type Method Description voidserialize(MultiTypeWrapper wrapper, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider)Serializes a MultiTypeWrapper into the appropriate JSON primitive, delegating to the static writeValueNotNull method for all non-null and non-string values.static booleanwriteValue(java.lang.Object object, com.fasterxml.jackson.core.JsonGenerator jsonGenerator)Serializes an Object representing any primitive JSON type, delegating to writeValueNotNull for all non-null and non-string objects.
-
Constructor Details
-
Serializer
public Serializer()
-
-
Method Details
-
serialize
public void serialize(MultiTypeWrapper wrapper, com.fasterxml.jackson.core.JsonGenerator jsonGenerator, com.fasterxml.jackson.databind.SerializerProvider serializerProvider) throws java.io.IOExceptionSerializes a MultiTypeWrapper into the appropriate JSON primitive, delegating to the static writeValueNotNull method for all non-null and non-string values. If writeValueNotNull returns false, meaning no value was written, then this method will default to writing the value as a string- Specified by:
serializein classcom.fasterxml.jackson.databind.JsonSerializer<MultiTypeWrapper>- Parameters:
wrapper-jsonGenerator-serializerProvider-- Throws:
java.io.IOException
-
writeValue
public static boolean writeValue(java.lang.Object object, com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws java.io.IOExceptionSerializes an Object representing any primitive JSON type, delegating to writeValueNotNull for all non-null and non-string objects.- Parameters:
object-jsonGenerator-- Returns:
- true when the jsonGenerator wrote a value, false if no matching type could be found and therefore no value was written.
- Throws:
java.io.IOException
-