Skip to content

Commit 9d75e3d

Browse files
authored
Changes wrt databind/#3043 (#521)
1 parent 6852120 commit 9d75e3d

30 files changed

+95
-103
lines changed

avro/src/main/java/tools/jackson/dataformat/avro/AvroModule.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import tools.jackson.databind.AnnotationIntrospector;
1212
import tools.jackson.databind.JacksonModule;
13-
import tools.jackson.databind.SerializerProvider;
13+
import tools.jackson.databind.SerializationContext;
1414
import tools.jackson.databind.module.SimpleDeserializers;
1515
import tools.jackson.databind.module.SimpleSerializers;
1616
import tools.jackson.databind.ser.std.StdSerializer;
@@ -120,7 +120,7 @@ public SchemaSerializer() {
120120
}
121121

122122
@Override
123-
public void serialize(Schema value, JsonGenerator gen, SerializerProvider prov)
123+
public void serialize(Schema value, JsonGenerator gen, SerializationContext prov)
124124
throws JacksonException
125125
{
126126
// Let's simply write as String, for now

avro/src/main/java/tools/jackson/dataformat/avro/AvroTypeResolverBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tools.jackson.databind.DatabindContext;
88
import tools.jackson.databind.DeserializationContext;
99
import tools.jackson.databind.JavaType;
10-
import tools.jackson.databind.SerializerProvider;
10+
import tools.jackson.databind.SerializationContext;
1111
import tools.jackson.databind.jsontype.NamedType;
1212
import tools.jackson.databind.jsontype.PolymorphicTypeValidator;
1313
import tools.jackson.databind.jsontype.TypeDeserializer;
@@ -38,7 +38,7 @@ public static AvroTypeResolverBuilder construct(JsonTypeInfo.Value config) {
3838
}
3939

4040
@Override
41-
public TypeSerializer buildTypeSerializer(SerializerProvider ctxt, JavaType baseType,
41+
public TypeSerializer buildTypeSerializer(SerializationContext ctxt, JavaType baseType,
4242
Collection<NamedType> subtypes) {
4343
// All type information is encoded in the schema, never in the data.
4444
return null;

avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroInstantSerializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import tools.jackson.core.JsonParser;
1212

1313
import tools.jackson.databind.JavaType;
14-
import tools.jackson.databind.SerializerProvider;
14+
import tools.jackson.databind.SerializationContext;
1515
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
1616
import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor;
1717
import tools.jackson.databind.ser.std.StdScalarSerializer;
@@ -54,7 +54,7 @@ protected AvroInstantSerializer(Class<T> t, Function<T, Instant> getInstant) {
5454
}
5555

5656
@Override
57-
public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws JacksonException {
57+
public void serialize(T value, JsonGenerator gen, SerializationContext provider) throws JacksonException {
5858
/**
5959
* Number of milliseconds, independent of a particular time zone or calendar,
6060
* from 1 January 1970 00:00:00.000 UTC.

avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateSerializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tools.jackson.core.JsonParser;
88

99
import tools.jackson.databind.JavaType;
10-
import tools.jackson.databind.SerializerProvider;
10+
import tools.jackson.databind.SerializationContext;
1111
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
1212
import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor;
1313
import tools.jackson.databind.ser.std.StdScalarSerializer;
@@ -36,7 +36,7 @@ protected AvroLocalDateSerializer() {
3636
}
3737

3838
@Override
39-
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider provider) throws JacksonException {
39+
public void serialize(LocalDate value, JsonGenerator gen, SerializationContext provider) throws JacksonException {
4040
/**
4141
* Number of days from the unix epoch, 1 January 1970.
4242
*/

avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateTimeSerializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import tools.jackson.core.JsonParser;
1010

1111
import tools.jackson.databind.JavaType;
12-
import tools.jackson.databind.SerializerProvider;
12+
import tools.jackson.databind.SerializationContext;
1313
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
1414
import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor;
1515
import tools.jackson.databind.ser.std.StdScalarSerializer;
@@ -38,7 +38,7 @@ protected AvroLocalDateTimeSerializer() {
3838
}
3939

4040
@Override
41-
public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider provider)
41+
public void serialize(LocalDateTime value, JsonGenerator gen, SerializationContext provider)
4242
throws JacksonException
4343
{
4444
/**

avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalTimeSerializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tools.jackson.core.JsonParser;
88

99
import tools.jackson.databind.JavaType;
10-
import tools.jackson.databind.SerializerProvider;
10+
import tools.jackson.databind.SerializationContext;
1111
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper;
1212
import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor;
1313
import tools.jackson.databind.ser.std.StdScalarSerializer;
@@ -36,7 +36,7 @@ protected AvroLocalTimeSerializer() {
3636
}
3737

3838
@Override
39-
public void serialize(LocalTime value, JsonGenerator gen, SerializerProvider provider) throws JacksonException {
39+
public void serialize(LocalTime value, JsonGenerator gen, SerializationContext provider) throws JacksonException {
4040
/**
4141
* Number of milliseconds, with no reference to a particular calendar, time zone or date, after
4242
* midnight, 00:00:00.000.

avro/src/main/java/tools/jackson/dataformat/avro/schema/ArrayVisitor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.apache.avro.Schema.Type;
99

1010
import tools.jackson.databind.JavaType;
11-
import tools.jackson.databind.SerializerProvider;
11+
import tools.jackson.databind.SerializationContext;
1212
import tools.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor;
1313
import tools.jackson.databind.jsonFormatVisitors.JsonFormatTypes;
1414
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable;
@@ -23,7 +23,7 @@ public class ArrayVisitor
2323

2424
protected Schema _elementSchema;
2525

26-
public ArrayVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperImpl visitorWrapper)
26+
public ArrayVisitor(SerializationContext p, JavaType type, VisitorFormatWrapperImpl visitorWrapper)
2727
{
2828
super(p);
2929
_type = type;

avro/src/main/java/tools/jackson/dataformat/avro/schema/DefinedSchemas.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.apache.avro.Schema;
66

77
import tools.jackson.databind.JavaType;
8-
import tools.jackson.databind.SerializerProvider;
8+
import tools.jackson.databind.SerializationContext;
99

1010
/**
1111
* Simple container for Schemas that have already been generated during
@@ -15,7 +15,7 @@ public class DefinedSchemas
1515
{
1616
protected final Map<JavaType, Schema> _schemas = new LinkedHashMap<>();
1717

18-
protected SerializerProvider _provider;
18+
protected SerializationContext _serializationContext;
1919

2020
/*
2121
/**********************************************************************
@@ -25,12 +25,12 @@ public class DefinedSchemas
2525

2626
public DefinedSchemas() { }
2727

28-
public void setProvider(SerializerProvider provider) {
29-
_provider = provider;
28+
public void setContext(SerializationContext ctxt) {
29+
_serializationContext = ctxt;
3030
}
3131

32-
public SerializerProvider getProvider() {
33-
return _provider;
32+
public SerializationContext getContext() {
33+
return _serializationContext;
3434
}
3535

3636
/*

avro/src/main/java/tools/jackson/dataformat/avro/schema/EnumVisitor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
public class EnumVisitor extends JsonStringFormatVisitor.Base
1717
implements SchemaBuilder
1818
{
19-
protected final SerializerProvider _provider;
19+
protected final SerializationContext _provider;
2020
protected final JavaType _type;
2121
protected final DefinedSchemas _schemas;
2222

2323
protected Set<String> _enums;
2424

25-
public EnumVisitor(SerializerProvider provider, DefinedSchemas schemas, JavaType t) {
25+
public EnumVisitor(SerializationContext provider, DefinedSchemas schemas, JavaType t) {
2626
_schemas = schemas;
2727
_type = t;
2828
_provider = provider;

avro/src/main/java/tools/jackson/dataformat/avro/schema/MapVisitor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.apache.avro.Schema;
44

55
import tools.jackson.databind.JavaType;
6-
import tools.jackson.databind.SerializerProvider;
6+
import tools.jackson.databind.SerializationContext;
77
import tools.jackson.databind.introspect.AnnotatedClass;
88
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable;
99
import tools.jackson.databind.jsonFormatVisitors.JsonMapFormatVisitor;
@@ -19,7 +19,7 @@ public class MapVisitor extends JsonMapFormatVisitor.Base
1919

2020
protected JavaType _keyType;
2121

22-
public MapVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperImpl visitorWrapper)
22+
public MapVisitor(SerializationContext p, JavaType type, VisitorFormatWrapperImpl visitorWrapper)
2323
{
2424
super(p);
2525
_type = type;

avro/src/main/java/tools/jackson/dataformat/avro/schema/RecordVisitor.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class RecordVisitor
4040

4141
protected List<Schema.Field> _fields = new ArrayList<>();
4242

43-
public RecordVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperImpl visitorWrapper)
43+
public RecordVisitor(SerializationContext p, JavaType type, VisitorFormatWrapperImpl visitorWrapper)
4444
{
4545
super(p);
4646
_type = type;
@@ -66,9 +66,9 @@ public RecordVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperIm
6666
} else if (subTypes != null && !subTypes.isEmpty()) {
6767
List<Schema> unionSchemas = new ArrayList<>();
6868
for (NamedType subType : subTypes) {
69-
ValueSerializer<?> ser = getProvider().findValueSerializer(subType.getType());
69+
ValueSerializer<?> ser = getContext().findValueSerializer(subType.getType());
7070
VisitorFormatWrapperImpl visitor = _visitorWrapper.createChildWrapper();
71-
ser.acceptJsonFormatVisitor(visitor, getProvider().getTypeFactory().constructType(subType.getType()));
71+
ser.acceptJsonFormatVisitor(visitor, getContext().getTypeFactory().constructType(subType.getType()));
7272
unionSchemas.add(visitor.getAvroSchema());
7373
}
7474
_avroSchema = Schema.createUnion(unionSchemas);
@@ -173,10 +173,10 @@ protected Schema.Field schemaFieldForWriter(BeanProperty prop, boolean optional)
173173
// 2-Mar-2017, bryan: AvroEncode annotation expects to have the schema used directly
174174
optional = optional && !(ser instanceof CustomEncodingSerializer); // Don't modify schema
175175
}
176-
final SerializerProvider prov = getProvider();
176+
final SerializationContext prov = getContext();
177177
if (ser == null) {
178178
if (prov == null) {
179-
throw DatabindException.from(prov, "SerializerProvider missing for RecordVisitor");
179+
throw DatabindException.from(prov, "SerializationContext missing for RecordVisitor");
180180
}
181181
ser = prov.findPrimaryPropertySerializer(prop.getType(), prop);
182182
}
@@ -210,7 +210,7 @@ protected Schema.Field schemaFieldForWriter(BeanProperty prop, boolean optional)
210210
if (meta != null) {
211211
field.addProp(meta.key(), meta.value());
212212
}
213-
List<PropertyName> aliases = prop.findAliases(getProvider().getConfig());
213+
List<PropertyName> aliases = prop.findAliases(getContext().getConfig());
214214
if (!aliases.isEmpty()) {
215215
for (PropertyName pn : aliases) {
216216
field.addAlias(pn.getSimpleName());

avro/src/main/java/tools/jackson/dataformat/avro/schema/StringVisitor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
import tools.jackson.core.JsonParser.NumberType;
88

99
import tools.jackson.databind.JavaType;
10-
import tools.jackson.databind.SerializerProvider;
10+
import tools.jackson.databind.SerializationContext;
1111
import tools.jackson.databind.introspect.AnnotatedClass;
1212
import tools.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor;
1313
import tools.jackson.databind.jsonFormatVisitors.JsonValueFormat;
1414

1515
public class StringVisitor extends JsonStringFormatVisitor.Base
1616
implements SchemaBuilder
1717
{
18-
protected final SerializerProvider _provider;
18+
protected final SerializationContext _provider;
1919
protected final JavaType _type;
2020

21-
public StringVisitor(SerializerProvider provider, JavaType type) {
21+
public StringVisitor(SerializationContext provider, JavaType type) {
2222
_type = type;
2323
_provider = provider;
2424
}

avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorBase.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
import org.apache.avro.Schema;
44

5-
import tools.jackson.databind.SerializerProvider;
6-
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWithSerializerProvider;
5+
import tools.jackson.databind.SerializationContext;
6+
import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWithSerializationContext;
77

88
public abstract class VisitorBase
9-
implements JsonFormatVisitorWithSerializerProvider,
9+
implements JsonFormatVisitorWithSerializationContext,
1010
SchemaBuilder
1111
{
12-
protected SerializerProvider _provider;
12+
protected SerializationContext _provider;
1313

1414
@Override
1515
public abstract Schema builtAvroSchema();
1616

1717
@Override
18-
public SerializerProvider getProvider() {
18+
public SerializationContext getContext() {
1919
return _provider;
2020
}
2121

2222
@Override
23-
public void setProvider(SerializerProvider provider) {
23+
public void setContext(SerializationContext provider) {
2424
_provider = provider;
2525
}
2626
}

0 commit comments

Comments
 (0)