io.prestosql.jdbc.$internal.jackson.databind.ser.BeanSerializer Maven / Gradle / Ivy
package io.prestosql.jdbc.$internal.jackson.databind.ser;
import java.io.IOException;
import java.util.Set;
import io.prestosql.jdbc.$internal.jackson.core.JsonGenerator;
import io.prestosql.jdbc.$internal.jackson.databind.*;
import io.prestosql.jdbc.$internal.jackson.databind.ser.impl.BeanAsArraySerializer;
import io.prestosql.jdbc.$internal.jackson.databind.ser.impl.ObjectIdWriter;
import io.prestosql.jdbc.$internal.jackson.databind.ser.impl.UnwrappingBeanSerializer;
import io.prestosql.jdbc.$internal.jackson.databind.ser.std.BeanSerializerBase;
import io.prestosql.jdbc.$internal.jackson.databind.util.NameTransformer;
/**
* Serializer class that can serialize Java objects that map
* to JSON Object output. Internally handling is mostly dealt with
* by a sequence of {@link 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 {@link #resolve} method, and NOT from constructor;
* otherwise we could end up with an infinite loop.
*/
public class BeanSerializer
extends BeanSerializerBase
{
private static final long serialVersionUID = 29; // as per jackson 2.9
/*
/**********************************************************
/* Life-cycle: constructors
/**********************************************************
*/
/**
* @param builder Builder object that contains collected information
* that may be needed for serializer
* @param properties Property writers used for actual serialization
*/
public BeanSerializer(JavaType type, BeanSerializerBuilder builder,
BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties)
{
super(type, builder, properties, filteredProperties);
}
/**
* Alternate copy constructor that can be used to construct
* standard {@link BeanSerializer} passing an instance of
* "compatible enough" source serializer.
*/
protected BeanSerializer(BeanSerializerBase src) {
super(src);
}
protected BeanSerializer(BeanSerializerBase src,
ObjectIdWriter objectIdWriter) {
super(src, objectIdWriter);
}
protected BeanSerializer(BeanSerializerBase src,
ObjectIdWriter objectIdWriter, Object filterId) {
super(src, objectIdWriter, filterId);
}
protected BeanSerializer(BeanSerializerBase src, Set toIgnore) {
super(src, toIgnore);
}
// @since 2.11.1
protected BeanSerializer(BeanSerializerBase src,
BeanPropertyWriter[] properties, BeanPropertyWriter[] filteredProperties) {
super(src, properties, filteredProperties);
}
/*
/**********************************************************
/* Life-cycle: factory methods, fluent factories
/**********************************************************
*/
/**
* @deprecated Since 2.10
*/
@Deprecated
public static BeanSerializer createDummy(JavaType forType)
{
return new BeanSerializer(forType, null, NO_PROPS, null);
}
/**
* Method for constructing dummy bean serializer; one that
* never outputs any properties
*
* @since 2.10
*/
public static BeanSerializer createDummy(JavaType forType, BeanSerializerBuilder builder)
{
return new BeanSerializer(forType, builder, NO_PROPS, null);
}
@Override
public JsonSerializer