Skip to content

Changes wrt databind/#3043: rename SerializerProvider as SerializationContext #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

import org.eclipse.collections.api.BooleanIterable;
import org.eclipse.collections.api.iterator.BooleanIterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tools.jackson.core.JsonToken;
import tools.jackson.core.type.WritableTypeId;

import tools.jackson.databind.SerializerProvider;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.jsontype.TypeSerializer;
import tools.jackson.databind.ser.std.StdSerializer;

Expand All @@ -19,7 +19,7 @@ public ByteIterableSerializer() {
}

@Override
public void serialize(ByteIterable value, JsonGenerator g, SerializerProvider ctxt)
public void serialize(ByteIterable value, JsonGenerator g, SerializationContext ctxt)
throws JacksonException
{
byte[] arr = value.toArray();
Expand All @@ -28,7 +28,7 @@ public void serialize(ByteIterable value, JsonGenerator g, SerializerProvider ct

@Override
public void serializeWithType(
ByteIterable value, JsonGenerator g, SerializerProvider ctxt,
ByteIterable value, JsonGenerator g, SerializationContext ctxt,
TypeSerializer typeSer)
throws JacksonException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import tools.jackson.core.JsonToken;

import tools.jackson.core.type.WritableTypeId;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.SerializationFeature;
import tools.jackson.databind.SerializerProvider;
import tools.jackson.databind.jsontype.TypeSerializer;
import tools.jackson.databind.ser.std.StdSerializer;

Expand All @@ -21,15 +21,15 @@ protected CharIterableSerializer() {
}

@Override
public boolean isEmpty(SerializerProvider provider, CharIterable value) {
public boolean isEmpty(SerializationContext ctxt, CharIterable value) {
return value.isEmpty();
}

@Override
public void serialize(CharIterable value, JsonGenerator gen, SerializerProvider provider)
public void serialize(CharIterable value, JsonGenerator gen, SerializationContext ctxt)
throws JacksonException
{
if (provider.isEnabled(SerializationFeature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS)) {
if (ctxt.isEnabled(SerializationFeature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS)) {
gen.writeStartArray();
writeContentsAsArray(value, gen);
gen.writeEndArray();
Expand All @@ -43,7 +43,7 @@ public void serialize(CharIterable value, JsonGenerator gen, SerializerProvider
public void serializeWithType(
CharIterable value,
JsonGenerator g,
SerializerProvider ctxt,
SerializationContext ctxt,
TypeSerializer typeSer)
throws JacksonException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

import org.eclipse.collections.api.DoubleIterable;
import org.eclipse.collections.api.iterator.DoubleIterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.SerializerProvider;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.type.TypeFactory;
import tools.jackson.datatype.primitive_collections_base.ser.PrimitiveIterableSerializer;

Expand All @@ -19,7 +19,7 @@ protected EclipsePrimitiveIterableSerializer(Class<C> type, JavaType elementType
}

@Override
public boolean isEmpty(SerializerProvider prov, C value) {
public boolean isEmpty(SerializationContext ctxt, C value) {
return value.isEmpty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

import org.eclipse.collections.api.FloatIterable;
import org.eclipse.collections.api.iterator.FloatIterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

import org.eclipse.collections.api.IntIterable;
import org.eclipse.collections.api.iterator.IntIterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

import org.eclipse.collections.api.LongIterable;
import org.eclipse.collections.api.iterator.LongIterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.type.TypeFactory;

import org.eclipse.collections.api.ShortIterable;
import org.eclipse.collections.api.iterator.ShortIterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package tools.jackson.datatype.eclipsecollections.ser.map;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.ValueSerializer;
import tools.jackson.databind.SerializerProvider;
import java.util.Set;
import java.util.function.BiConsumer;

import tools.jackson.databind.*;
import tools.jackson.databind.jsontype.TypeSerializer;
import tools.jackson.databind.ser.std.StdContainerSerializer;
import tools.jackson.datatype.primitive_collections_base.ser.map.RefRefMapSerializer;

import org.eclipse.collections.api.map.MapIterable;

import java.util.Set;
import java.util.function.BiConsumer;

/**
* @author yawkat
*/
Expand Down Expand Up @@ -55,7 +52,7 @@ public boolean hasSingleElement(MapIterable<?, ?> map) {
}

@Override
public boolean isEmpty(SerializerProvider prov, MapIterable<?, ?> value) {
public boolean isEmpty(SerializationContext ctxt, MapIterable<?, ?> value) {
return value.isEmpty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.Map;

import tools.jackson.core.JsonGenerator;
import tools.jackson.databind.SerializerProvider;
import tools.jackson.databind.SerializationContext;

import tools.jackson.datatype.primitive_collections_base.ser.map.PrimitiveMapSerializer;

Expand All @@ -32,7 +32,7 @@ public static Map<Class<? extends PrimitiveIterable>, PrimitiveMapSerializer<?>>
private static final PrimitiveMapSerializer<ByteShortMap> BYTE_SHORT =
new PrimitiveMapSerializer<ByteShortMap>(ByteShortMap.class) {
@Override
protected void serializeEntries(ByteShortMap value, JsonGenerator g, SerializerProvider serializers)
protected void serializeEntries(ByteShortMap value, JsonGenerator g, SerializationContext ctxt)
{
value.forEachKeyValue((k, v) -> {
g.writeName(String.valueOf(k));
Expand All @@ -47,7 +47,7 @@ protected void serializeEntries(ByteShortMap value, JsonGenerator g, SerializerP
}

@Override
public boolean isEmpty(SerializerProvider provider, ByteShortMap value) {
public boolean isEmpty(SerializationContext ctxt, ByteShortMap value) {
return value.isEmpty();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ public Char(JavaType type, BeanProperty property, TypeSerializer vts, ValueSeria
}

@Override
protected void serializeEntries(CharObjectMap<V> value, JsonGenerator g, SerializerProvider serializers)
{
protected void serializeEntries(CharObjectMap<V> value, JsonGenerator g, SerializationContext ctxt) {
value.forEachKeyValue((k, v) -> {
g.writeName(String.valueOf(k));
_serializeValue(v, g, serializers);
_serializeValue(v, g, ctxt);
});
}

Expand All @@ -43,7 +42,7 @@ protected PrimitiveRefMapSerializer<CharObjectMap<V>, V> withResolved(
}

@Override
public boolean isEmpty(SerializerProvider provider, CharObjectMap<V> value) {
public boolean isEmpty(SerializationContext ctxt, CharObjectMap<V> value) {
return value.isEmpty();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import tools.jackson.core.JsonGenerator;

import tools.jackson.databind.BeanProperty;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.ValueSerializer;
import tools.jackson.databind.SerializerProvider;
import tools.jackson.databind.*;

import tools.jackson.datatype.primitive_collections_base.ser.map.RefPrimitiveMapSerializer;

Expand Down Expand Up @@ -36,10 +33,10 @@ protected RefPrimitiveMapSerializer<ObjectCharMap<K>, K> withResolved(
}

@Override
protected void serializeEntries(ObjectCharMap<K> value, JsonGenerator g, SerializerProvider serializers)
protected void serializeEntries(ObjectCharMap<K> value, JsonGenerator g, SerializationContext ctxt)
{
value.forEachKeyValue((k, v) -> {
_serializeKey(k, g, serializers);
_serializeKey(k, g, ctxt);
/* if !(char|boolean value) //
g.writeNumber(v);
/* elif char value */
Expand All @@ -51,7 +48,7 @@ protected void serializeEntries(ObjectCharMap<K> value, JsonGenerator g, Seriali
}

@Override
public boolean isEmpty(SerializerProvider provider, ObjectCharMap<K> value) {
public boolean isEmpty(SerializationContext ctxt, ObjectCharMap<K> value) {
return value.isEmpty();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import tools.jackson.databind.introspect.AnnotatedField;
import tools.jackson.databind.introspect.TypeResolutionContext;

/**
* @since 2.10
*/
public class RangeHelper
{
public static class RangeProperties implements java.io.Serializable
Expand Down
Loading
Loading