Top Constructors Methods
com.fasterxml.jackson.databind.ser.impl

public Class UnknownSerializer

extends ToEmptyObjectSerializer
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.io.IOException, com.fasterxml.jackson.core.*, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.ser.std.ToEmptyObjectSerializer, com.fasterxml.jackson.databind.util.NativeImageUtil

Deprecated

as a consequence of ToEmptyObjectSerializer being deprecated. See corresponding docs for further information.

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected void
public void
serialize(Object
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
gen
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
ctxt
)

Overrides com.fasterxml.jackson.databind.ser.std.ToEmptyObjectSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.
public void
serializeWithType(Object
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
gen
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
ctxt
,
TypeSerializer
Type serializer to use for including type information
typeSer
)

Overrides com.fasterxml.jackson.databind.ser.std.ToEmptyObjectSerializer.serializeWithType.

Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.
Inherited from com.fasterxml.jackson.databind.ser.std.ToEmptyObjectSerializer:
acceptJsonFormatVisitorgetSchemaisEmpty

Constructor Detail

UnknownSerializerback to summary
public UnknownSerializer()
UnknownSerializerback to summary
public UnknownSerializer(Class<?> cls)

Method Detail

failForEmptyback to summary
protected void failForEmpty(SerializerProvider prov, Object value) throws JsonMappingException
serializeback to summary
public void serialize(Object value, JsonGenerator gen, SerializerProvider ctxt) throws IOException

Overrides com.fasterxml.jackson.databind.ser.std.ToEmptyObjectSerializer.serialize.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.

Parameters
value:Object

Value to serialize; can not be null.

gen:JsonGenerator

Generator used to output resulting Json content

ctxt:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(Object value, JsonGenerator gen, SerializerProvider ctxt, TypeSerializer typeSer) throws IOException

Overrides com.fasterxml.jackson.databind.ser.std.ToEmptyObjectSerializer.serializeWithType.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.

Default implementation will throw UnsupportedOperationException to indicate that proper type handling needs to be implemented.

For simple datatypes written as a single scalar value (JSON String, Number, Boolean), implementation would look like:

  // note: method to call depends on whether this type is serialized as JSON scalar, object or Array!
  typeSer.writeTypePrefixForScalar(value, gen);
  serialize(value, gen, provider);
  typeSer.writeTypeSuffixForScalar(value, gen);
and implementations for type serialized as JSON Arrays or Objects would differ slightly, as START-ARRAY/END-ARRAY and START-OBJECT/END-OBJECT pairs need to be properly handled with respect to serializing of contents.
Parameters
value:Object

Value to serialize; can not be null.

gen:JsonGenerator

Generator used to output resulting Json content

ctxt:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

typeSer:TypeSerializer

Type serializer to use for including type information

Annotations
@Override