Class SerializationContext

java.lang.Object
tools.jackson.databind.DatabindContext
tools.jackson.databind.SerializationContext
All Implemented Interfaces:
tools.jackson.core.ObjectWriteContext
Direct Known Subclasses:
SerializationContextExt

public abstract class SerializationContext extends DatabindContext implements tools.jackson.core.ObjectWriteContext
Class that defines API used by ObjectMapper and ValueSerializers to obtain serializers capable of serializing instances of specific types; as well as the default implementation of the functionality.

Provider handles caching aspects of serializer handling; all construction details are delegated to SerializerFactory instance.

NOTE: In Jackson 2.x this class was called SerializerProvider.

  • Field Details

    • DEFAULT_UNKNOWN_SERIALIZER

      protected static final ValueSerializer<Object> DEFAULT_UNKNOWN_SERIALIZER
      Placeholder serializer used when java.lang.Object typed property is marked to be serialized.
      NOTE: starting with 2.6, this instance is NOT used for any other types, and separate instances are constructed for "empty" Beans.
    • _config

      protected final SerializationConfig _config
      Serialization configuration to use for serialization processing.
    • _generatorConfig

      protected final GeneratorSettings _generatorConfig
      Configuration to be used by streaming generator when it is constructed.
      Since:
      3.0
    • _streamFactory

      protected final tools.jackson.core.TokenStreamFactory _streamFactory
      Low-level TokenStreamFactory that may be used for constructing embedded generators.
    • _generator

      protected transient tools.jackson.core.JsonGenerator _generator
      Token stream generator actively used; only set for per-call instances
      Since:
      3.0
    • _writeCapabilities

      protected tools.jackson.core.util.JacksonFeatureSet<tools.jackson.core.StreamWriteCapability> _writeCapabilities
      Capabilities of the output format.
      Since:
      3.0
    • _activeView

      protected final Class<?> _activeView
      View used for currently active serialization, if any.
    • _serializerFactory

      protected final SerializerFactory _serializerFactory
      Factory used for constructing actual serializer instances. Only set for non-blueprint instances.
    • _nullValueSerializer

      protected final ValueSerializer<Object> _nullValueSerializer
      Serializer used to output a null value. Default implementation writes nulls using JsonGenerator.writeNull().
    • _stdNullValueSerializer

      protected final boolean _stdNullValueSerializer
      Flag set to indicate that we are using vanilla null value serialization
    • _serializerCache

      protected final SerializerCache _serializerCache
      Cache for doing type-to-value-serializer lookups.
    • _knownSerializers

      protected final ReadOnlyClassToSerializerMap _knownSerializers
      For fast lookups, we will have a local non-shared read-only map that contains serializers previously fetched.
    • _dateFormat

      protected DateFormat _dateFormat
      Lazily acquired and instantiated formatter object: initialized first time it is needed, reused afterwards. Used via instances (not blueprints), so that access need not be thread-safe.
    • _classIntrospector

      protected transient ClassIntrospector _classIntrospector
      Lazily constructed ClassIntrospector instance: created from "blueprint"
    • _attributes

      protected ContextAttributes _attributes
      Lazily-constructed holder for per-call attributes. Only set for non-blueprint instances.
  • Constructor Details

  • Method Details

    • tokenStreamFactory

      public tools.jackson.core.TokenStreamFactory tokenStreamFactory()
      Specified by:
      tokenStreamFactory in interface tools.jackson.core.ObjectWriteContext
    • getSchema

      public tools.jackson.core.FormatSchema getSchema()
      Specified by:
      getSchema in interface tools.jackson.core.ObjectWriteContext
    • getCharacterEscapes

      public tools.jackson.core.io.CharacterEscapes getCharacterEscapes()
      Specified by:
      getCharacterEscapes in interface tools.jackson.core.ObjectWriteContext
    • getPrettyPrinter

      public tools.jackson.core.PrettyPrinter getPrettyPrinter()
      Specified by:
      getPrettyPrinter in interface tools.jackson.core.ObjectWriteContext
    • hasPrettyPrinter

      public boolean hasPrettyPrinter()
      Specified by:
      hasPrettyPrinter in interface tools.jackson.core.ObjectWriteContext
    • getRootValueSeparator

      public tools.jackson.core.SerializableString getRootValueSeparator(tools.jackson.core.SerializableString defaultSeparator)
      Specified by:
      getRootValueSeparator in interface tools.jackson.core.ObjectWriteContext
    • getStreamWriteFeatures

      public int getStreamWriteFeatures(int defaults)
      Specified by:
      getStreamWriteFeatures in interface tools.jackson.core.ObjectWriteContext
    • getFormatWriteFeatures

      public int getFormatWriteFeatures(int defaults)
      Specified by:
      getFormatWriteFeatures in interface tools.jackson.core.ObjectWriteContext
    • createArrayNode

      public tools.jackson.core.tree.ArrayTreeNode createArrayNode()
      Specified by:
      createArrayNode in interface tools.jackson.core.ObjectWriteContext
    • createObjectNode

      public tools.jackson.core.tree.ObjectTreeNode createObjectNode()
      Specified by:
      createObjectNode in interface tools.jackson.core.ObjectWriteContext
    • writeValue

      public void writeValue(tools.jackson.core.JsonGenerator gen, Object value) throws tools.jackson.core.JacksonException
      Specified by:
      writeValue in interface tools.jackson.core.ObjectWriteContext
      Throws:
      tools.jackson.core.JacksonException
    • writeTree

      public void writeTree(tools.jackson.core.JsonGenerator gen, tools.jackson.core.TreeNode tree) throws tools.jackson.core.JacksonException
      Specified by:
      writeTree in interface tools.jackson.core.ObjectWriteContext
      Throws:
      tools.jackson.core.JacksonException
    • getConfig

      public final SerializationConfig getConfig()
      Method for accessing configuration for the serialization processing.
      Specified by:
      getConfig in class DatabindContext
    • getAnnotationIntrospector

      public final AnnotationIntrospector getAnnotationIntrospector()
      Description copied from class: DatabindContext
      Convenience method for accessing serialization view in use (if any); equivalent to:
         getConfig().getAnnotationIntrospector();
      
      Specified by:
      getAnnotationIntrospector in class DatabindContext
    • getTypeFactory

      public final TypeFactory getTypeFactory()
      Specified by:
      getTypeFactory in class DatabindContext
    • constructSpecializedType

      public JavaType constructSpecializedType(JavaType baseType, Class<?> subclass) throws IllegalArgumentException
      Description copied from class: DatabindContext
      Convenience method for constructing subtypes, retaining generic type parameter (if any).

      Note: since 2.11 handling has varied a bit across serialization, deserialization.

      Specified by:
      constructSpecializedType in class DatabindContext
      Throws:
      IllegalArgumentException
    • getActiveView

      public final Class<?> getActiveView()
      Description copied from class: DatabindContext
      Accessor for locating currently active view, if any; returns null if no view has been set.
      Specified by:
      getActiveView in class DatabindContext
    • canOverrideAccessModifiers

      public final boolean canOverrideAccessModifiers()
      Description copied from class: DatabindContext
      Convenience method for accessing serialization view in use (if any); equivalent to:
         getConfig().canOverrideAccessModifiers();
      
      Specified by:
      canOverrideAccessModifiers in class DatabindContext
    • isEnabled

      public final boolean isEnabled(MapperFeature feature)
      Description copied from class: DatabindContext
      Convenience method for checking whether specified Mapper feature is enabled or not. Shortcut for:
        getConfig().isEnabled(feature);
      
      Specified by:
      isEnabled in class DatabindContext
    • isEnabled

      public final boolean isEnabled(DatatypeFeature feature)
      Description copied from class: DatabindContext
      Method for checking whether specified datatype feature is enabled or not.
      Specified by:
      isEnabled in class DatabindContext
    • getDatatypeFeatures

      public final DatatypeFeatures getDatatypeFeatures()
      Specified by:
      getDatatypeFeatures in class DatabindContext
    • getDefaultPropertyFormat

      public final JsonFormat.Value getDefaultPropertyFormat(Class<?> baseType)
      Specified by:
      getDefaultPropertyFormat in class DatabindContext
    • getDefaultPropertyInclusion

      public final JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType)
    • getLocale

      public Locale getLocale()
      Method for accessing default Locale to use: convenience method for
         getConfig().getLocale();
      
      Specified by:
      getLocale in class DatabindContext
    • getTimeZone

      public TimeZone getTimeZone()
      Method for accessing default TimeZone to use: convenience method for
         getConfig().getTimeZone();
      
      Specified by:
      getTimeZone in class DatabindContext
    • classIntrospector

      protected ClassIntrospector classIntrospector()
      Specified by:
      classIntrospector in class DatabindContext
    • introspectBeanDescription

      public BeanDescription introspectBeanDescription(JavaType type, AnnotatedClass ac)
      Specified by:
      introspectBeanDescription in class DatabindContext
    • findRootName

      public PropertyName findRootName(JavaType rootType)
      Specified by:
      findRootName in class DatabindContext
    • findRootName

      public PropertyName findRootName(Class<?> rawRootType)
      Specified by:
      findRootName in class DatabindContext
    • getAttribute

      public Object getAttribute(Object key)
      Description copied from class: DatabindContext
      Method for accessing attributes available in this context. Per-call attributes have highest precedence; attributes set via ObjectReader or ObjectWriter have lower precedence.
      Specified by:
      getAttribute in class DatabindContext
      Parameters:
      key - Key of the attribute to get
      Returns:
      Value of the attribute, if any; null otherwise
    • setAttribute

      public SerializationContext setAttribute(Object key, Object value)
      Description copied from class: DatabindContext
      Method for setting per-call value of given attribute. This will override any previously defined value for the attribute within this context.
      Specified by:
      setAttribute in class DatabindContext
      Parameters:
      key - Key of the attribute to set
      value - Value to set attribute to
      Returns:
      This context object, to allow chaining
    • isEnabled

      public final boolean isEnabled(SerializationFeature feature)
      Convenience method for checking whether specified serialization feature is enabled or not. Shortcut for:
        getConfig().isEnabled(feature);
      
    • hasSerializationFeatures

      public final boolean hasSerializationFeatures(int featureMask)
      "Bulk" access method for checking that all features specified by mask are enabled.
    • isEnabled

      public final boolean isEnabled(tools.jackson.core.StreamWriteCapability cap)
      Accessor for checking whether input format has specified capability or not.
      Returns:
      True if input format has specified capability; false if not
    • getFilterProvider

      public final FilterProvider getFilterProvider()
      Convenience method for accessing provider to find serialization filters used, equivalent to calling:
         getConfig().getFilterProvider();
      
    • getGenerator

      public tools.jackson.core.JsonGenerator getGenerator()
    • bufferForValueConversion

      public TokenBuffer bufferForValueConversion()
      Specialized factory method used when we are converting values and do not typically have or use "real" parsers or generators.
    • findObjectId

      public abstract WritableObjectId findObjectId(Object forPojo, ObjectIdGenerator<?> generatorType)
      Method called to find the Object Id for given POJO, if one has been generated. Will always return a non-null Object; contents vary depending on whether an Object Id already exists or not.
    • findTypedValueSerializer

      public ValueSerializer<Object> findTypedValueSerializer(Class<?> rawType, boolean cache)
      Method called to locate regular serializer, matching type serializer, and if both found, wrap them in a serializer that calls both in correct sequence. This method is mostly used for root-level serializer handling to allow for simpler caching. A call can always be replaced by equivalent calls to access serializer and type serializer separately. Note: contextualization (call to ValueSerializer.createContextual(tools.jackson.databind.SerializationContext, tools.jackson.databind.BeanProperty)) is done before returning the ValueSerializer.
      Parameters:
      rawType - Type for purpose of locating a serializer; usually dynamic runtime type, but can also be static declared type, depending on configuration
      cache - Whether resulting value serializer should be cached or not
    • findTypedValueSerializer

      public ValueSerializer<Object> findTypedValueSerializer(JavaType valueType, boolean cache)
      Method called to locate regular serializer, matching type serializer, and if both found, wrap them in a serializer that calls both in correct sequence. This method is mostly used for root-level serializer handling to allow for simpler caching. A call can always be replaced by equivalent calls to access serializer and type serializer separately. Note: contextualization (call to ValueSerializer.createContextual(tools.jackson.databind.SerializationContext, tools.jackson.databind.BeanProperty)) is done before returning the ValueSerializer.
      Parameters:
      valueType - Declared type of value being serialized (which may not be actual runtime type); used for finding both value serializer and type serializer to use for adding polymorphic type (if any)
      cache - Whether resulting value serializer should be cached or not
    • findRootValueSerializer

      public ValueSerializer<Object> findRootValueSerializer(Class<?> rawType)
      Method for finding (from cache) or creating (and caching) serializer for given type, without checking for polymorphic typing, and then contextualizing without actual property. This is most often used for root-level values (when writing sequences), but may sometimes be used for more esoteric value handling for delegation. Note: contextualization (call to ValueSerializer.createContextual(tools.jackson.databind.SerializationContext, tools.jackson.databind.BeanProperty)) is done before returning the ValueSerializer.
      Since:
      3.0
    • findRootValueSerializer

      public ValueSerializer<Object> findRootValueSerializer(JavaType valueType)
      Method for finding (from cache) or creating (and caching) serializer for given type, without checking for polymorphic typing, and then contextualizing without actual property. This is most often used for root-level values (when writing sequences), but may sometimes be used for more esoteric value handling for delegation. Note: contextualization (call to ValueSerializer.createContextual(tools.jackson.databind.SerializationContext, tools.jackson.databind.BeanProperty)) is done before returning the ValueSerializer.
      Since:
      3.0
    • findPrimaryPropertySerializer

      public ValueSerializer<Object> findPrimaryPropertySerializer(JavaType valueType, BeanProperty property)
      Method used for locating "primary" property value serializer (one directly handling value of the property). Difference (if any) has to do with contextual resolution, and method(s) called: this method should only be called when caller is certain that this is the primary property value serializer. Contextualization (call to ValueSerializer.createContextual(SerializationContext, BeanProperty) will be done before returning the ValueSerializer.
      Parameters:
      property - Property that is being handled; will never be null, and its type has to match valueType parameter.
    • findPrimaryPropertySerializer

      public ValueSerializer<Object> findPrimaryPropertySerializer(Class<?> rawType, BeanProperty property)
      See Also:
    • findContentValueSerializer

      public ValueSerializer<Object> findContentValueSerializer(JavaType valueType, BeanProperty property)
      Method similar to findPrimaryPropertySerializer(JavaType, BeanProperty) but used for "content values", secondary types used by "primary" serializers for structured types like Arrays, Collections, Maps and so on.

      Serializer will be contextualized, but will not have type serializer wrapped.

      Parameters:
      valueType - Type of (secondary / content) values being serialized
      property - (optional) Property that refers to values via primary type (so type DOES NOT necessarily match valueType)
    • findContentValueSerializer

      public ValueSerializer<Object> findContentValueSerializer(Class<?> rawType, BeanProperty property)
    • findValueSerializer

      public ValueSerializer<Object> findValueSerializer(Class<?> rawType)
      See Also:
    • findValueSerializer

      public ValueSerializer<Object> findValueSerializer(JavaType valueType)
      Method variant used when we do NOT want contextualization to happen; it will need to be done at a later point (many serializers are not in operational state before contextualization, call to ValueSerializer.createContextual(SerializationContext, BeanProperty)), but caller wants to be able to do that at a later point; sometimes to avoid infinite loops
    • findTypeSerializer

      public TypeSerializer findTypeSerializer(JavaType baseType)
      Method called to get the TypeSerializer to use for including Type Id necessary for serializing for the given Java class. Useful for schema generators.
    • findTypeSerializer

      public TypeSerializer findTypeSerializer(JavaType baseType, AnnotatedClass classAnnotations)
      Method called to get the TypeSerializer to use for including Type Id necessary for serializing for the given Java class. Useful for schema generators.
      Since:
      3.0
    • findPropertyTypeSerializer

      public TypeSerializer findPropertyTypeSerializer(JavaType baseType, AnnotatedMember accessor)
      Like findTypeSerializer(JavaType), but for use from specific POJO property. Method called to create a type information serializer for values of given non-container property if one is needed. If not needed (no polymorphic handling configured), should return null.
      Parameters:
      baseType - Declared type to use as the base type for type information serializer
      Returns:
      Type serializer to use for property values, if one is needed; null if not.
      Since:
      3.0
    • findKeySerializer

      public ValueSerializer<Object> findKeySerializer(JavaType keyType, BeanProperty property)
      Method called to get the serializer to use for serializing non-null Map keys. Separation from regular findValueSerializer(java.lang.Class<?>) method is because actual write method must be different (@link JsonGenerator#writeName}; but also since behavior for some key types may differ.

      Note that the serializer itself can be called with instances of any Java object, but not nulls.

    • findKeySerializer

      public ValueSerializer<Object> findKeySerializer(Class<?> rawKeyType, BeanProperty property)
    • getDefaultNullValueSerializer

      public ValueSerializer<Object> getDefaultNullValueSerializer()
    • findNullKeySerializer

      public ValueSerializer<Object> findNullKeySerializer(JavaType serializationType, BeanProperty property)
      Method called to find a serializer to use for null values for given declared type. Note that type is completely based on declared type, since nulls in Java have no type and thus runtime type cannot be determined.
    • findNullValueSerializer

      public ValueSerializer<Object> findNullValueSerializer(BeanProperty property)
      Method called to get the serializer to use for serializing null values for specified property.

      Default implementation simply calls getDefaultNullValueSerializer(); can be overridden to add custom null serialization for properties of certain type or name. This gives method full granularity to basically override null handling for any specific property or class of properties.

    • getUnknownTypeSerializer

      public ValueSerializer<Object> getUnknownTypeSerializer(Class<?> unknownType)
      Method called to get the serializer to use if provider cannot determine an actual type-specific serializer to use; typically when none of SerializerFactory instances are able to construct a serializer.

      Typically, returned serializer will throw an exception, although alternatively ToStringSerializer could be returned as well.

      Parameters:
      unknownType - Type for which no serializer is found
    • isUnknownTypeSerializer

      public boolean isUnknownTypeSerializer(ValueSerializer<?> ser)
      Helper method called to see if given serializer is considered to be something returned by getUnknownTypeSerializer(java.lang.Class<?>), that is, something for which no regular serializer was found or constructed.
    • _createAndCacheUntypedSerializer

      protected ValueSerializer<Object> _createAndCacheUntypedSerializer(Class<?> rawType, JavaType fullType)
      Method that will try to construct a value serializer; and if one is successfully created, cache it for reuse.
    • _createAndCacheUntypedSerializer

      protected ValueSerializer<Object> _createAndCacheUntypedSerializer(JavaType type)
    • _createAndCachePropertySerializer

      protected ValueSerializer<Object> _createAndCachePropertySerializer(Class<?> rawType, JavaType fullType, BeanProperty prop)
      Alternative to _createAndCacheUntypedSerializer(Class, JavaType), used when serializer is requested for given property.
    • _createAndCachePropertySerializer

      protected ValueSerializer<Object> _createAndCachePropertySerializer(JavaType type, BeanProperty prop)
      Alternative to _createAndCacheUntypedSerializer(JavaType), used when serializer is requested for given property.
    • _handleResolvable

      protected ValueSerializer<Object> _handleResolvable(ValueSerializer<?> ser)
    • serializerInstance

      public abstract ValueSerializer<Object> serializerInstance(Annotated annotated, Object serDef)
      Method that can be called to construct and configure serializer instance, either given a Class to instantiate (with default constructor), or an uninitialized serializer instance. Either way, serializer will be properly resolved (via ValueSerializer.resolve(tools.jackson.databind.SerializationContext)).
      Parameters:
      annotated - Annotated entity that contained definition
      serDef - Serializer definition: either an instance or class
    • includeFilterInstance

      public abstract Object includeFilterInstance(BeanPropertyDefinition forProperty, Class<?> filterClass)
      Method that can be called to construct and configure JsonInclude filter instance, given a Class to instantiate (with default constructor, by default).
      Parameters:
      forProperty - (optional) If filter is created for a property, that property; `null` if filter created via defaulting, global or per-type.
    • includeFilterSuppressNulls

      public abstract boolean includeFilterSuppressNulls(Object filter)
      Follow-up method that may be called after calling includeFilterInstance(tools.jackson.databind.introspect.BeanPropertyDefinition, java.lang.Class<?>), to check handling of `null` values by the filter.
    • handlePrimaryContextualization

      public ValueSerializer<Object> handlePrimaryContextualization(ValueSerializer<?> ser, BeanProperty property)
      Method called for primary property serializers (ones directly created to serialize values of a POJO property), to handle details of contextualization, calling ValueSerializer.createContextual(SerializationContext, BeanProperty) with given property context.
      Parameters:
      property - Property for which the given primary serializer is used; never null.
    • handleSecondaryContextualization

      public ValueSerializer<Object> handleSecondaryContextualization(ValueSerializer<?> ser, BeanProperty property)
      Method called for secondary property serializers (ones NOT directly created to serialize values of a POJO property but instead created as a dependant serializer -- such as value serializers for structured types, or serializers for root values) to handle details of contextualization, calling ValueSerializer.createContextual(SerializationContext, BeanProperty) with given property context. Given that these serializers are not directly related to given property (or, in case of root value property, to any property), annotations accessible may or may not be relevant.
      Parameters:
      property - Property for which serializer is used, if any; null when deserializing root values
    • handleRootContextualization

      public ValueSerializer<Object> handleRootContextualization(ValueSerializer<?> ser)
      Since:
      3.0
    • defaultSerializeProperty

      public final void defaultSerializeProperty(String propertyName, Object value, tools.jackson.core.JsonGenerator g) throws tools.jackson.core.JacksonException
      Convenience method that will serialize given property with specified value, using the default serializer for runtime type of value.
      Throws:
      tools.jackson.core.JacksonException
    • defaultSerializeDateValue

      public final void defaultSerializeDateValue(long timestamp, tools.jackson.core.JsonGenerator g) throws tools.jackson.core.JacksonException
      Method that will handle serialization of Date(-like) values, using SerializationConfig settings to determine expected serialization behavior. Note: date here means "full" date, that is, date AND time, as per Java convention (and not date-only values like in SQL)
      Throws:
      tools.jackson.core.JacksonException
    • defaultSerializeDateValue

      public final void defaultSerializeDateValue(Date date, tools.jackson.core.JsonGenerator g) throws tools.jackson.core.JacksonException
      Method that will handle serialization of Date(-like) values, using SerializationConfig settings to determine expected serialization behavior. Note: date here means "full" date, that is, date AND time, as per Java convention (and not date-only values like in SQL)
      Throws:
      tools.jackson.core.JacksonException
    • defaultSerializeDateKey

      public void defaultSerializeDateKey(long timestamp, tools.jackson.core.JsonGenerator g) throws tools.jackson.core.JacksonException
      Method that will handle serialization of Dates used as Map keys, based on DateTimeFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS value (and if using textual representation, configured date format)
      Throws:
      tools.jackson.core.JacksonException
    • defaultSerializeDateKey

      public void defaultSerializeDateKey(Date date, tools.jackson.core.JsonGenerator g) throws tools.jackson.core.JacksonException
      Method that will handle serialization of Dates used as Map keys, based on DateTimeFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS value (and if using textual representation, configured date format)
      Throws:
      tools.jackson.core.JacksonException
    • defaultSerializeNullValue

      public final void defaultSerializeNullValue(tools.jackson.core.JsonGenerator g) throws tools.jackson.core.JacksonException
      Method to call when serializing a null value (POJO property, Map entry value, Collection/array element) using configured standard mechanism. Note that this does NOT consider filtering any more as value is expected.
      Throws:
      tools.jackson.core.JacksonException
      Since:
      3.0 (in 2.x was called defaultSerializeNull)
    • valueToTree

      public abstract <T extends JsonNode> T valueToTree(Object fromValue) throws tools.jackson.core.JacksonException
      Method that will convert given Java value (usually bean) into its equivalent Tree mode JsonNode representation. Functionally similar to serializing value into token stream and parsing that stream back as tree model node, but more efficient as TokenBuffer is used to contain the intermediate representation instead of fully serialized contents.

      NOTE: while results are usually identical to that of serialization followed by deserialization, this is not always the case. In some cases serialization into intermediate representation will retain encapsulation of things like raw value (RawValue) or basic node identity (JsonNode). If so, result is a valid tree, but values are not re-constructed through actual format representation. So if transformation requires actual materialization of encoded content, it will be necessary to do actual serialization.

      Type Parameters:
      T - Actual node type; usually either basic JsonNode or ObjectNode
      Parameters:
      fromValue - Java value to convert
      Returns:
      (non-null) Root node of the resulting content tree: in case of null value node for which JsonNode.isNull() returns true.
      Throws:
      tools.jackson.core.JacksonException
    • reportBadTypeDefinition

      public <T> T reportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs) throws DatabindException
      Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific Java type, unrelated to actual JSON content to map. Default behavior is to construct and throw a InvalidDefinitionException.
      Specified by:
      reportBadTypeDefinition in class DatabindContext
      Throws:
      DatabindException
    • reportBadPropertyDefinition

      public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String message, Object... msgArgs) throws DatabindException
      Helper method called to indicate problem in POJO (serialization) definitions or settings regarding specific property (of a type), unrelated to actual JSON content to map. Default behavior is to construct and throw a InvalidDefinitionException.
      Throws:
      DatabindException
    • reportBadDefinition

      public <T> T reportBadDefinition(JavaType type, String msg) throws DatabindException
      Description copied from class: DatabindContext
      Helper method called to indicate a generic problem that stems from type definition(s), not input data, or input/output state; typically this means throwing a InvalidDefinitionException.
      Specified by:
      reportBadDefinition in class DatabindContext
      Throws:
      DatabindException
    • reportBadDefinition

      public <T> T reportBadDefinition(JavaType type, String msg, Throwable cause) throws DatabindException
      Throws:
      DatabindException
    • reportBadDefinition

      public <T> T reportBadDefinition(Class<?> raw, String msg, Throwable cause) throws DatabindException
      Throws:
      DatabindException
    • reportMappingProblem

      public void reportMappingProblem(Throwable t, String message, Object... msgArgs) throws DatabindException
      Helper method called to indicate problem; default behavior is to construct and throw a DatabindException, but in future may collect more than one and only throw after certain number, or at the end of serialization.
      Throws:
      DatabindException
    • _mappingProblem

      protected DatabindException _mappingProblem(Throwable t, String message, Object... msgArgs)
    • reportMappingProblem

      public void reportMappingProblem(String message, Object... msgArgs) throws DatabindException
      Helper method called to indicate problem; default behavior is to construct and throw a DatabindException, but in future may collect more than one and only throw after certain number, or at the end of serialization.
      Throws:
      DatabindException
    • invalidTypeIdException

      public DatabindException invalidTypeIdException(JavaType baseType, String typeId, String extraDesc)
      Description copied from class: DatabindContext
      Helper method for constructing exception to indicate that given type id could not be resolved to a valid subtype of specified base type. Most commonly called during polymorphic deserialization.

      Note that most of the time this method should NOT be called directly: instead, method handleUnknownTypeId() should be called which will call this method if necessary.

      Specified by:
      invalidTypeIdException in class DatabindContext
    • _reportIncompatibleRootType

      protected void _reportIncompatibleRootType(Object value, JavaType rootType) throws tools.jackson.core.JacksonException
      Throws:
      tools.jackson.core.JacksonException
    • _assignGenerator

      protected void _assignGenerator(tools.jackson.core.JsonGenerator g)
      Method called to assign the generator to use for writing output; also updates configuration settings that depend on generator.
      Parameters:
      g - Generator to use for writing output
    • _dateFormat

      protected final DateFormat _dateFormat()