public abstract class TypeSerializer extends Object
JsonSerializer
s using proper contextual
calls, to add type information using mechanism type serializer was
configured with.
NOTE: version 2.9 contains significant attempt at simplifying interface,
as well as giving format implementation (via JsonGenerator
) more
control over actual serialization details.
Constructor and Description |
---|
TypeSerializer() |
Modifier and Type | Method and Description |
---|---|
protected void |
_writeLegacySuffix(JsonGenerator g,
WritableTypeId typeId)
Helper method needed for backwards compatibility: since original type id
can not be routed through completely, we have to reverse-engineer likely
setting before calling suffix.
|
abstract TypeSerializer |
forProperty(BeanProperty prop)
Method called to create contextual version, to be used for
values of given property.
|
abstract String |
getPropertyName()
Name of property that contains type information, if
property-based inclusion is used.
|
abstract TypeIdResolver |
getTypeIdResolver()
Accessor for object that handles conversions between
types and matching type ids.
|
abstract JsonTypeInfo.As |
getTypeInclusion()
Accessor for type information inclusion method
that serializer uses; indicates how type information
is embedded in resulting JSON.
|
WritableTypeId |
typeId(Object value,
Class<?> typeForId,
JsonToken valueShape) |
WritableTypeId |
typeId(Object value,
JsonToken valueShape)
Factory method for constructing type id value object to pass to
writeTypePrefix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId) . |
WritableTypeId |
typeId(Object value,
JsonToken valueShape,
Object id) |
void |
writeCustomTypePrefixForArray(Object value,
JsonGenerator g,
String typeId)
Deprecated.
|
void |
writeCustomTypePrefixForObject(Object value,
JsonGenerator g,
String typeId)
Deprecated.
|
void |
writeCustomTypePrefixForScalar(Object value,
JsonGenerator g,
String typeId)
Deprecated.
|
void |
writeCustomTypeSuffixForArray(Object value,
JsonGenerator g,
String typeId)
Deprecated.
|
void |
writeCustomTypeSuffixForObject(Object value,
JsonGenerator g,
String typeId)
Deprecated.
|
void |
writeCustomTypeSuffixForScalar(Object value,
JsonGenerator g,
String typeId)
Deprecated.
|
abstract WritableTypeId |
writeTypePrefix(JsonGenerator g,
WritableTypeId typeId)
Method called to write initial part of type information for given
value, along with possible wrapping to use: details are specified
by `typeId` argument.
|
void |
writeTypePrefixForArray(Object value,
JsonGenerator g)
Deprecated.
|
void |
writeTypePrefixForArray(Object value,
JsonGenerator g,
Class<?> type)
Deprecated.
|
void |
writeTypePrefixForObject(Object value,
JsonGenerator g)
Deprecated.
|
void |
writeTypePrefixForObject(Object value,
JsonGenerator g,
Class<?> type)
Deprecated.
|
void |
writeTypePrefixForScalar(Object value,
JsonGenerator g)
Deprecated.
|
void |
writeTypePrefixForScalar(Object value,
JsonGenerator g,
Class<?> type)
Deprecated.
|
abstract WritableTypeId |
writeTypeSuffix(JsonGenerator g,
WritableTypeId typeId) |
void |
writeTypeSuffixForArray(Object value,
JsonGenerator g)
Deprecated.
|
void |
writeTypeSuffixForObject(Object value,
JsonGenerator g)
Deprecated.
|
void |
writeTypeSuffixForScalar(Object value,
JsonGenerator g)
Deprecated.
|
public abstract TypeSerializer forProperty(BeanProperty prop)
Collection
or Map
valued properties).public abstract JsonTypeInfo.As getTypeInclusion()
public abstract String getPropertyName()
public abstract TypeIdResolver getTypeIdResolver()
public WritableTypeId typeId(Object value, JsonToken valueShape)
writeTypePrefix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId)
.public WritableTypeId typeId(Object value, JsonToken valueShape, Object id)
public WritableTypeId typeId(Object value, Class<?> typeForId, JsonToken valueShape)
public abstract WritableTypeId writeTypePrefix(JsonGenerator g, WritableTypeId typeId) throws IOException
g
- Generator to use for outputting type id and possible wrappingtypeId
- Details of what type id is to be written, how.IOException
public abstract WritableTypeId writeTypeSuffix(JsonGenerator g, WritableTypeId typeId) throws IOException
IOException
@Deprecated public void writeTypePrefixForScalar(Object value, JsonGenerator g) throws IOException
value
- Value that will be serialized, for which type information is
to be writteng
- Generator to use for writing type informationIOException
@Deprecated public void writeTypePrefixForObject(Object value, JsonGenerator g) throws IOException
value
- Value that will be serialized, for which type information is
to be writteng
- Generator to use for writing type informationIOException
@Deprecated public void writeTypePrefixForArray(Object value, JsonGenerator g) throws IOException
value
- Value that will be serialized, for which type information is
to be writteng
- Generator to use for writing type informationIOException
@Deprecated public void writeTypeSuffixForScalar(Object value, JsonGenerator g) throws IOException
writeTypePrefixForScalar(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)
.
Actual action to take may depend on various factors, but has to match with
action writeTypePrefixForScalar(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)
did (close array or object; or do nothing).IOException
@Deprecated public void writeTypeSuffixForObject(Object value, JsonGenerator g) throws IOException
writeTypePrefixForObject(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)
.
It needs to write closing END_OBJECT marker, and any other decoration
that needs to be matched.IOException
@Deprecated public void writeTypeSuffixForArray(Object value, JsonGenerator g) throws IOException
writeTypeSuffixForScalar(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator)
.
It needs to write closing END_ARRAY marker, and any other decoration
that needs to be matched.IOException
@Deprecated public void writeTypePrefixForScalar(Object value, JsonGenerator g, Class<?> type) throws IOException
IOException
@Deprecated public void writeTypePrefixForObject(Object value, JsonGenerator g, Class<?> type) throws IOException
IOException
@Deprecated public void writeTypePrefixForArray(Object value, JsonGenerator g, Class<?> type) throws IOException
IOException
@Deprecated public void writeCustomTypePrefixForScalar(Object value, JsonGenerator g, String typeId) throws IOException
IOException
@Deprecated public void writeCustomTypePrefixForObject(Object value, JsonGenerator g, String typeId) throws IOException
IOException
@Deprecated public void writeCustomTypePrefixForArray(Object value, JsonGenerator g, String typeId) throws IOException
IOException
@Deprecated public void writeCustomTypeSuffixForScalar(Object value, JsonGenerator g, String typeId) throws IOException
IOException
@Deprecated public void writeCustomTypeSuffixForObject(Object value, JsonGenerator g, String typeId) throws IOException
IOException
@Deprecated public void writeCustomTypeSuffixForArray(Object value, JsonGenerator g, String typeId) throws IOException
IOException
protected final void _writeLegacySuffix(JsonGenerator g, WritableTypeId typeId) throws IOException
IOException
Copyright © 2018 JBoss by Red Hat. All rights reserved.