Class JsonValueSerializer

All Implemented Interfaces:
JsonFormatVisitable, SchemaAware, ContextualSerializer, Serializable

public class JsonValueSerializer extends StdSerializer<Object> implements ContextualSerializer, JsonFormatVisitable
Serializer class that can serialize Object that have a JsonValue annotation to indicate that serialization should be done by calling the method annotated, and serializing result it returns.

Implementation note: we will post-process resulting serializer (much like what is done with BeanSerializer) to figure out actual serializers for final types. This must be done from createContextual(com.fasterxml.jackson.databind.SerializerProvider, com.fasterxml.jackson.databind.BeanProperty) method, and NOT from constructor; otherwise we could end up with an infinite loop.

See Also:
  • Field Details

    • _accessor

      protected final AnnotatedMember _accessor
      Since:
      2.9
    • _valueTypeSerializer

      protected final TypeSerializer _valueTypeSerializer
      Since:
      2.12
    • _valueSerializer

      protected final JsonSerializer<Object> _valueSerializer
    • _property

      protected final BeanProperty _property
    • _valueType

      protected final JavaType _valueType
      Declared type of the value accessed, as declared by accessor.
      Since:
      2.12
    • _forceTypeInformation

      protected final boolean _forceTypeInformation
      This is a flag that is set in rare (?) cases where this serializer is used for "natural" types (boolean, int, String, double); and where we actually must force type information wrapping, even though one would not normally be added.
    • _ignoredProperties

      protected final Set<String> _ignoredProperties
      Names of properties to ignore from Value class accessed using accessor.
      Since:
      2.16
    • _dynamicSerializers

      protected transient PropertySerializerMap _dynamicSerializers
      If value type cannot be statically determined, mapping from runtime value types to serializers are cached in this object.
      Since:
      2.12
  • Constructor Details

  • Method Details