java.lang.Object
tools.jackson.databind.ValueSerializer<T>
tools.jackson.databind.ser.std.StdSerializer<T>
tools.jackson.databind.ser.std.StdScalarSerializer<Object>
tools.jackson.databind.ser.jdk.StringSerializer
- All Implemented Interfaces:
JsonFormatVisitable
This is the special serializer for regular
String
s.
Since this is one of "native" types, no type information is ever included on serialization (unlike for most scalar types as of 1.5)
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.ValueSerializer
ValueSerializer.None
-
Field Summary
FieldsFields inherited from class tools.jackson.databind.ser.std.StdSerializer
_handledType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptJsonFormatVisitor
(JsonFormatVisitorWrapper visitor, JavaType typeHint) Default implementation specifies no format.boolean
isEmpty
(SerializationContext prov, Object value) Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).void
serialize
(Object value, JsonGenerator gen, SerializationContext provider) Method that can be called to ask implementation to serialize values of type this serializer handles.final void
serializeWithType
(Object value, JsonGenerator gen, SerializationContext provider, TypeSerializer typeSer) Default implementation will write type prefix, call regular serialization method (since assumption is that value itself does not need JSON Array or Object start/end markers), and then write type suffix.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, wrapAndThrow
Methods inherited from class tools.jackson.databind.ValueSerializer
createContextual, getDelegatee, isUnwrappingSerializer, properties, replaceDelegatee, resolve, unwrappingSerializer, usesObjectId, withFilterId, withFormatOverrides, withIgnoredProperties
-
Field Details
-
instance
-
-
Constructor Details
-
StringSerializer
public StringSerializer()
-
-
Method Details
-
isEmpty
Description copied from class:ValueSerializer
Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).Default implementation will consider only null values to be empty.
- Overrides:
isEmpty
in classValueSerializer<Object>
-
serialize
public void serialize(Object value, JsonGenerator gen, SerializationContext provider) throws JacksonException Description copied from class:ValueSerializer
Method that can be called to ask implementation to serialize values of type this serializer handles.- Specified by:
serialize
in classStdSerializer<Object>
- Parameters:
value
- Value to serialize; can not be null.gen
- 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(Object value, JsonGenerator gen, SerializationContext provider, TypeSerializer typeSer) throws JacksonException Description copied from class:StdScalarSerializer
Default implementation will write type prefix, call regular serialization method (since assumption is that value itself does not need JSON Array or Object start/end markers), and then write type suffix. This should work for most cases; some sub-classes may want to change this behavior.- Overrides:
serializeWithType
in classStdScalarSerializer<Object>
- Parameters:
value
- Value to serialize; can not be null.gen
- Generator used to output resulting Json contentprovider
- 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:StdSerializer
Default implementation specifies no format. This behavior is usually overriden by custom serializers.- Specified by:
acceptJsonFormatVisitor
in interfaceJsonFormatVisitable
- Overrides:
acceptJsonFormatVisitor
in classStdScalarSerializer<Object>
typeHint
- Type of element (entity like property) being visited
-