Module tools.jackson.databind
Class TokenBufferSerializer
java.lang.Object
tools.jackson.databind.ValueSerializer<T>
tools.jackson.databind.ser.std.StdSerializer<TokenBuffer>
tools.jackson.databind.ser.jackson.TokenBufferSerializer
- All Implemented Interfaces:
JsonFormatVisitable
We also want to directly support serialization of
TokenBuffer;
and since it is part of core package, it cannot implement
JacksonSerializable
(which is only included in the mapper package)-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.ValueSerializer
ValueSerializer.None -
Field Summary
Fields inherited from class tools.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) Default implementation specifies no format.voidserialize(TokenBuffer value, JsonGenerator jgen, SerializationContext provider) Method that can be called to ask implementation to serialize values of type this serializer handles.final voidserializeWithType(TokenBuffer value, JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) Implementing typed output for contents of a TokenBuffer is very tricky, since we do not know for sure what its contents might look like (or, rather, we do know when serializing, but not necessarily when deserializing!)Methods inherited from class tools.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, _wrapIOFailure, acceptJsonFormatVisitorForBinary, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowMethods inherited from class tools.jackson.databind.ValueSerializer
createContextual, getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, resolve, unwrappingSerializer, usesObjectId, withFilterId, withFormatOverrides, withIgnoredProperties
-
Constructor Details
-
TokenBufferSerializer
public TokenBufferSerializer()
-
-
Method Details
-
serialize
public void serialize(TokenBuffer value, JsonGenerator jgen, SerializationContext provider) throws JacksonException Description copied from class:ValueSerializerMethod that can be called to ask implementation to serialize values of type this serializer handles.- Specified by:
serializein classStdSerializer<TokenBuffer>- Parameters:
value- Value to serialize; can not be null.jgen- Generator used to output resulting Json contentprovider- Context that can be used to get serializers for serializing Objects value contains, if any.- Throws:
JacksonException
-
serializeWithType
public final void serializeWithType(TokenBuffer value, JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) throws JacksonException Implementing typed output for contents of a TokenBuffer is very tricky, since we do not know for sure what its contents might look like (or, rather, we do know when serializing, but not necessarily when deserializing!) One possibility would be to check the current token, and use that to determine if we would output JSON Array, Object or scalar value.Note that we just claim it is scalar; this should work ok and is simpler than doing introspection on both serialization and deserialization.
- Overrides:
serializeWithTypein classValueSerializer<TokenBuffer>- Parameters:
value- Value to serialize; can not be null.g- Generator used to output resulting Json contentctxt- Context that can be used to get serializers for serializing Objects value contains, if any.typeSer- Type serializer to use for including type information- Throws:
JacksonException
-
acceptJsonFormatVisitor
Description copied from class:StdSerializerDefault implementation specifies no format. This behavior is usually overriden by custom serializers.- Specified by:
acceptJsonFormatVisitorin interfaceJsonFormatVisitable- Overrides:
acceptJsonFormatVisitorin classStdSerializer<TokenBuffer>typeHint- Type of element (entity like property) being visited
-