public class NumberSerializer extends StdScalarSerializer<Number> implements ContextualSerializer
Numbers: both custom types and "big" numbers
like BigInteger and BigDecimal.JsonSerializer.None| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_isInt |
static NumberSerializer |
instance
Static instance that is only to be used for
Number. |
protected static int |
MAX_BIG_DECIMAL_SCALE
Copied from `jackson-core` class `GeneratorBase`
|
_handledType| Constructor and Description |
|---|
NumberSerializer(Class<? extends Number> rawType) |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor,
JavaType typeHint)
Default implementation specifies no format.
|
static JsonSerializer<?> |
bigDecimalAsStringSerializer() |
JsonSerializer<?> |
createContextual(SerializerProvider prov,
BeanProperty property)
Method called to see if a different (or differently configured) serializer
is needed to serialize values of specified property.
|
JsonNode |
getSchema(SerializerProvider provider,
Type typeHint)
Default implementation simply claims type is "string"; usually
overriden by custom serializers.
|
void |
serialize(Number value,
JsonGenerator g,
SerializerProvider provider)
Method that can be called to ask implementation to serialize
values of type this serializer handles.
|
serializeWithType_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowgetDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterIdpublic static final NumberSerializer instance
Number.protected static final int MAX_BIG_DECIMAL_SCALE
protected final boolean _isInt
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException
ContextualSerializercreateContextual in interface ContextualSerializerprov - Serializer provider to use for accessing config, other serializersproperty - Method or field that represents the property
(and is used to access value to serialize).
Should be available; but there may be cases where caller cannot provide it and
null is passed instead (in which case impls usually pass 'this' serializer as is)JsonMappingExceptionpublic void serialize(Number value, JsonGenerator g, SerializerProvider provider) throws IOException
JsonSerializerserialize in class StdSerializer<Number>value - Value to serialize; can not be null.g - Generator used to output resulting Json contentprovider - Provider that can be used to get serializers for
serializing Objects value contains, if any.IOExceptionpublic JsonNode getSchema(SerializerProvider provider, Type typeHint)
StdSerializergetSchema in interface SchemaAwaregetSchema in class StdScalarSerializer<Number>provider - The serializer provider.typeHint - A hint about the type.public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializeracceptJsonFormatVisitor in interface JsonFormatVisitableacceptJsonFormatVisitor in class StdScalarSerializer<Number>typeHint - Type of element (entity like property) being visitedJsonMappingExceptionpublic static JsonSerializer<?> bigDecimalAsStringSerializer()
Copyright © 2008–2019 FasterXML. All rights reserved.