public class BeanSerializer extends BeanSerializerBase
BeanPropertyWriter
s that will handle
access value to serialize and call appropriate serializers to
write out JSON.
Implementation note: we will post-process resulting serializer,
to figure out actual serializers for final types. This must be
done from BeanSerializerBase.resolve(com.fasterxml.jackson.databind.SerializerProvider)
method, and NOT from constructor;
otherwise we could end up with an infinite loop.
JsonSerializer.None
Constructor and Description |
---|
BeanSerializer(JavaType type,
BeanSerializerBuilder builder,
BeanPropertyWriter[] properties,
BeanPropertyWriter[] filteredProperties) |
Modifier and Type | Method and Description |
---|---|
static BeanSerializer |
createDummy(JavaType forType)
Method for constructing dummy bean serializer; one that
never outputs any properties
|
void |
serialize(java.lang.Object bean,
JsonGenerator gen,
SerializerProvider provider)
Main serialization method that will delegate actual output to
configured
BeanPropertyWriter instances. |
java.lang.String |
toString() |
JsonSerializer<java.lang.Object> |
unwrappingSerializer(NameTransformer unwrapper)
Method that will return serializer instance that produces
"unwrapped" serialization, if applicable for type being
serialized (which is the case for some serializers
that produce JSON Objects as output).
|
BeanSerializerBase |
withFilterId(java.lang.Object filterId)
Mutant factory used for creating a new instance with different
filter id (used with
JsonFilter annotation) |
BeanSerializerBase |
withObjectIdWriter(ObjectIdWriter objectIdWriter)
Mutant factory used for creating a new instance with different
ObjectIdWriter . |
acceptJsonFormatVisitor, createContextual, getSchema, properties, resolve, serializeWithType, usesObjectId
getSchema, handledType, wrapAndThrow, wrapAndThrow
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, replaceDelegatee
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSchema
public BeanSerializer(JavaType type, BeanSerializerBuilder builder, BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties)
builder
- Builder object that contains collected information
that may be needed for serializerproperties
- Property writers used for actual serializationpublic static BeanSerializer createDummy(JavaType forType)
public JsonSerializer<java.lang.Object> unwrappingSerializer(NameTransformer unwrapper)
JsonSerializer
Default implementation just returns serializer as-is, indicating that no unwrapped variant exists
unwrappingSerializer
in class JsonSerializer<java.lang.Object>
unwrapper
- Name transformation to use to convert between names
of unwrapper propertiespublic BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter)
BeanSerializerBase
ObjectIdWriter
.withObjectIdWriter
in class BeanSerializerBase
public BeanSerializerBase withFilterId(java.lang.Object filterId)
BeanSerializerBase
JsonFilter
annotation)withFilterId
in class BeanSerializerBase
public final void serialize(java.lang.Object bean, JsonGenerator gen, SerializerProvider provider) throws java.io.IOException
BeanPropertyWriter
instances.serialize
in class BeanSerializerBase
bean
- Value to serialize; can not be null.gen
- Generator used to output resulting Json contentprovider
- Provider that can be used to get serializers for
serializing Objects value contains, if any.java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"