Class NumberSerializers.Base<T>

All Implemented Interfaces:
JsonFormatVisitable
Direct Known Subclasses:
NumberSerializers.DoubleSerializer, NumberSerializers.FloatSerializer, NumberSerializers.IntegerSerializer, NumberSerializers.IntLikeSerializer, NumberSerializers.LongSerializer, NumberSerializers.ShortSerializer
Enclosing class:
NumberSerializers

public abstract static class NumberSerializers.Base<T> extends StdScalarSerializer<T>
Base class for actual primitive/wrapper value serializers.

NOTE: while you can extend this class yourself it is not designed as an extension point, and as such is not part of public API. This means that the compatibility across minor versions is only guaranteed on minor-to-minor basis, and class methods may be changed and/or removed via deprecation mechanism. Intent is, however, to allow for gradual upgrading so that methods to remove are marked deprecated for at least one minor version.

  • Field Details

    • _numberType

      protected final tools.jackson.core.JsonParser.NumberType _numberType
    • _schemaType

      protected final String _schemaType
    • _isInt

      protected final boolean _isInt
  • Constructor Details

    • Base

      protected Base(Class<?> cls, tools.jackson.core.JsonParser.NumberType numberType, String schemaType)
  • Method Details

    • acceptJsonFormatVisitor

      public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
      Description copied from class: StdSerializer
      Default implementation specifies no format. This behavior is usually overriden by custom serializers.
      Specified by:
      acceptJsonFormatVisitor in interface JsonFormatVisitable
      Overrides:
      acceptJsonFormatVisitor in class StdScalarSerializer<T>
      typeHint - Type of element (entity like property) being visited
    • createContextual

      public ValueSerializer<?> createContextual(SerializationContext prov, BeanProperty property)
      Description copied from class: ValueSerializer
      Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed). Note that instance that this method is called on is typically shared one and as a result method should NOT modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use.

      Note that method is only called once per POJO property, and for the first usage as root value serializer; it is not called for every serialization, as doing that would have significant performance impact; most serializers cache contextual instances for future use.

      Overrides:
      createContextual in class ValueSerializer<T>
      Parameters:
      prov - Context to use for accessing config, other serializers
      property - Property (defined by one or more accessors - field or method - used for accessing logical property value) for which serializer is used to be used; or, `null` for root value (or in cases where caller does not have this information, which is handled as root value case).
      Returns:
      Serializer to use for serializing values of specified property; may be this instance or a new instance.