Module tools.jackson.databind
Package tools.jackson.databind.ser.jdk
Class NumberSerializers.IntegerSerializer
java.lang.Object
tools.jackson.databind.ValueSerializer<T>
tools.jackson.databind.ser.std.StdSerializer<T>
tools.jackson.databind.ser.std.StdScalarSerializer<T>
tools.jackson.databind.ser.jdk.NumberSerializers.Base<Object>
tools.jackson.databind.ser.jdk.NumberSerializers.IntegerSerializer
- All Implemented Interfaces:
JsonFormatVisitable
- Enclosing class:
- NumberSerializers
This is the special serializer for regular
Integer
s
(and primitive ints)
Since this is one of "natural" types, no type information is ever included
on serialization (unlike for most scalar types, except for double
).
-
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.jdk.NumberSerializers.Base
_isInt, _numberType, _schemaType
Fields inherited from class tools.jackson.databind.ser.std.StdSerializer
_handledType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
serialize
(Object value, tools.jackson.core.JsonGenerator gen, SerializationContext provider) Method that can be called to ask implementation to serialize values of type this serializer handles.void
serializeWithType
(Object value, tools.jackson.core.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.jdk.NumberSerializers.Base
acceptJsonFormatVisitor, createContextual
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
getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, resolve, unwrappingSerializer, usesObjectId, withFilterId, withFormatOverrides, withIgnoredProperties
-
Constructor Details
-
IntegerSerializer
-
-
Method Details
-
serialize
public void serialize(Object value, tools.jackson.core.JsonGenerator gen, SerializationContext provider) throws tools.jackson.core.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:
tools.jackson.core.JacksonException
-
serializeWithType
public void serializeWithType(Object value, tools.jackson.core.JsonGenerator gen, SerializationContext provider, TypeSerializer typeSer) throws tools.jackson.core.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:
tools.jackson.core.JacksonException
-