diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/AvroModule.java b/avro/src/main/java/tools/jackson/dataformat/avro/AvroModule.java index 62fb4589a..0f473dc4c 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/AvroModule.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/AvroModule.java @@ -10,7 +10,7 @@ import tools.jackson.databind.AnnotationIntrospector; import tools.jackson.databind.JacksonModule; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.module.SimpleDeserializers; import tools.jackson.databind.module.SimpleSerializers; import tools.jackson.databind.ser.std.StdSerializer; @@ -120,7 +120,7 @@ public SchemaSerializer() { } @Override - public void serialize(Schema value, JsonGenerator gen, SerializerProvider prov) + public void serialize(Schema value, JsonGenerator gen, SerializationContext prov) throws JacksonException { // Let's simply write as String, for now diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/AvroTypeResolverBuilder.java b/avro/src/main/java/tools/jackson/dataformat/avro/AvroTypeResolverBuilder.java index 254e6b57b..d57da87df 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/AvroTypeResolverBuilder.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/AvroTypeResolverBuilder.java @@ -7,7 +7,7 @@ import tools.jackson.databind.DatabindContext; import tools.jackson.databind.DeserializationContext; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsontype.NamedType; import tools.jackson.databind.jsontype.PolymorphicTypeValidator; import tools.jackson.databind.jsontype.TypeDeserializer; @@ -38,7 +38,7 @@ public static AvroTypeResolverBuilder construct(JsonTypeInfo.Value config) { } @Override - public TypeSerializer buildTypeSerializer(SerializerProvider ctxt, JavaType baseType, + public TypeSerializer buildTypeSerializer(SerializationContext ctxt, JavaType baseType, Collection subtypes) { // All type information is encoded in the schema, never in the data. return null; diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroInstantSerializer.java b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroInstantSerializer.java index 220365f30..8befdadd0 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroInstantSerializer.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroInstantSerializer.java @@ -11,7 +11,7 @@ import tools.jackson.core.JsonParser; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor; import tools.jackson.databind.ser.std.StdScalarSerializer; @@ -54,7 +54,7 @@ protected AvroInstantSerializer(Class t, Function getInstant) { } @Override - public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws JacksonException { + public void serialize(T value, JsonGenerator gen, SerializationContext provider) throws JacksonException { /** * Number of milliseconds, independent of a particular time zone or calendar, * from 1 January 1970 00:00:00.000 UTC. diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateSerializer.java b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateSerializer.java index 935e6730d..37ff6edc4 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateSerializer.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateSerializer.java @@ -7,7 +7,7 @@ import tools.jackson.core.JsonParser; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor; import tools.jackson.databind.ser.std.StdScalarSerializer; @@ -36,7 +36,7 @@ protected AvroLocalDateSerializer() { } @Override - public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider provider) throws JacksonException { + public void serialize(LocalDate value, JsonGenerator gen, SerializationContext provider) throws JacksonException { /** * Number of days from the unix epoch, 1 January 1970. */ diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateTimeSerializer.java b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateTimeSerializer.java index c3b338633..2b8cafc33 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateTimeSerializer.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalDateTimeSerializer.java @@ -9,7 +9,7 @@ import tools.jackson.core.JsonParser; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor; import tools.jackson.databind.ser.std.StdScalarSerializer; @@ -38,7 +38,7 @@ protected AvroLocalDateTimeSerializer() { } @Override - public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider provider) + public void serialize(LocalDateTime value, JsonGenerator gen, SerializationContext provider) throws JacksonException { /** diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalTimeSerializer.java b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalTimeSerializer.java index a1fbaa33a..fbe299e1e 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalTimeSerializer.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/jsr310/ser/AvroLocalTimeSerializer.java @@ -7,7 +7,7 @@ import tools.jackson.core.JsonParser; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.databind.jsonFormatVisitors.JsonIntegerFormatVisitor; import tools.jackson.databind.ser.std.StdScalarSerializer; @@ -36,7 +36,7 @@ protected AvroLocalTimeSerializer() { } @Override - public void serialize(LocalTime value, JsonGenerator gen, SerializerProvider provider) throws JacksonException { + public void serialize(LocalTime value, JsonGenerator gen, SerializationContext provider) throws JacksonException { /** * Number of milliseconds, with no reference to a particular calendar, time zone or date, after * midnight, 00:00:00.000. diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/ArrayVisitor.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/ArrayVisitor.java index 30f0c13a7..94241ba15 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/ArrayVisitor.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/ArrayVisitor.java @@ -8,7 +8,7 @@ import org.apache.avro.Schema.Type; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor; import tools.jackson.databind.jsonFormatVisitors.JsonFormatTypes; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; @@ -23,7 +23,7 @@ public class ArrayVisitor protected Schema _elementSchema; - public ArrayVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperImpl visitorWrapper) + public ArrayVisitor(SerializationContext p, JavaType type, VisitorFormatWrapperImpl visitorWrapper) { super(p); _type = type; diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/DefinedSchemas.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/DefinedSchemas.java index 21803dd5b..445b6c236 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/DefinedSchemas.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/DefinedSchemas.java @@ -5,7 +5,7 @@ import org.apache.avro.Schema; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; /** * Simple container for Schemas that have already been generated during @@ -15,7 +15,7 @@ public class DefinedSchemas { protected final Map _schemas = new LinkedHashMap<>(); - protected SerializerProvider _provider; + protected SerializationContext _serializationContext; /* /********************************************************************** @@ -25,12 +25,12 @@ public class DefinedSchemas public DefinedSchemas() { } - public void setProvider(SerializerProvider provider) { - _provider = provider; + public void setContext(SerializationContext ctxt) { + _serializationContext = ctxt; } - public SerializerProvider getProvider() { - return _provider; + public SerializationContext getContext() { + return _serializationContext; } /* diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/EnumVisitor.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/EnumVisitor.java index 7840ca4ea..3002e735f 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/EnumVisitor.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/EnumVisitor.java @@ -16,13 +16,13 @@ public class EnumVisitor extends JsonStringFormatVisitor.Base implements SchemaBuilder { - protected final SerializerProvider _provider; + protected final SerializationContext _provider; protected final JavaType _type; protected final DefinedSchemas _schemas; protected Set _enums; - public EnumVisitor(SerializerProvider provider, DefinedSchemas schemas, JavaType t) { + public EnumVisitor(SerializationContext provider, DefinedSchemas schemas, JavaType t) { _schemas = schemas; _type = t; _provider = provider; diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/MapVisitor.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/MapVisitor.java index 36200e4b2..7746a1102 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/MapVisitor.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/MapVisitor.java @@ -3,7 +3,7 @@ import org.apache.avro.Schema; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.introspect.AnnotatedClass; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import tools.jackson.databind.jsonFormatVisitors.JsonMapFormatVisitor; @@ -19,7 +19,7 @@ public class MapVisitor extends JsonMapFormatVisitor.Base protected JavaType _keyType; - public MapVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperImpl visitorWrapper) + public MapVisitor(SerializationContext p, JavaType type, VisitorFormatWrapperImpl visitorWrapper) { super(p); _type = type; diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/RecordVisitor.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/RecordVisitor.java index cf3bf4191..1b734471f 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/RecordVisitor.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/RecordVisitor.java @@ -40,7 +40,7 @@ public class RecordVisitor protected List _fields = new ArrayList<>(); - public RecordVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperImpl visitorWrapper) + public RecordVisitor(SerializationContext p, JavaType type, VisitorFormatWrapperImpl visitorWrapper) { super(p); _type = type; @@ -66,9 +66,9 @@ public RecordVisitor(SerializerProvider p, JavaType type, VisitorFormatWrapperIm } else if (subTypes != null && !subTypes.isEmpty()) { List unionSchemas = new ArrayList<>(); for (NamedType subType : subTypes) { - ValueSerializer ser = getProvider().findValueSerializer(subType.getType()); + ValueSerializer ser = getContext().findValueSerializer(subType.getType()); VisitorFormatWrapperImpl visitor = _visitorWrapper.createChildWrapper(); - ser.acceptJsonFormatVisitor(visitor, getProvider().getTypeFactory().constructType(subType.getType())); + ser.acceptJsonFormatVisitor(visitor, getContext().getTypeFactory().constructType(subType.getType())); unionSchemas.add(visitor.getAvroSchema()); } _avroSchema = Schema.createUnion(unionSchemas); @@ -173,10 +173,10 @@ protected Schema.Field schemaFieldForWriter(BeanProperty prop, boolean optional) // 2-Mar-2017, bryan: AvroEncode annotation expects to have the schema used directly optional = optional && !(ser instanceof CustomEncodingSerializer); // Don't modify schema } - final SerializerProvider prov = getProvider(); + final SerializationContext prov = getContext(); if (ser == null) { if (prov == null) { - throw DatabindException.from(prov, "SerializerProvider missing for RecordVisitor"); + throw DatabindException.from(prov, "SerializationContext missing for RecordVisitor"); } ser = prov.findPrimaryPropertySerializer(prop.getType(), prop); } @@ -210,7 +210,7 @@ protected Schema.Field schemaFieldForWriter(BeanProperty prop, boolean optional) if (meta != null) { field.addProp(meta.key(), meta.value()); } - List aliases = prop.findAliases(getProvider().getConfig()); + List aliases = prop.findAliases(getContext().getConfig()); if (!aliases.isEmpty()) { for (PropertyName pn : aliases) { field.addAlias(pn.getSimpleName()); diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/StringVisitor.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/StringVisitor.java index 67bd54e59..e4b1fc083 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/StringVisitor.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/StringVisitor.java @@ -7,7 +7,7 @@ import tools.jackson.core.JsonParser.NumberType; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.introspect.AnnotatedClass; import tools.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor; import tools.jackson.databind.jsonFormatVisitors.JsonValueFormat; @@ -15,10 +15,10 @@ public class StringVisitor extends JsonStringFormatVisitor.Base implements SchemaBuilder { - protected final SerializerProvider _provider; + protected final SerializationContext _provider; protected final JavaType _type; - public StringVisitor(SerializerProvider provider, JavaType type) { + public StringVisitor(SerializationContext provider, JavaType type) { _type = type; _provider = provider; } diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorBase.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorBase.java index c069cae26..29b205584 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorBase.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorBase.java @@ -2,25 +2,25 @@ import org.apache.avro.Schema; -import tools.jackson.databind.SerializerProvider; -import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWithSerializerProvider; +import tools.jackson.databind.SerializationContext; +import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWithSerializationContext; public abstract class VisitorBase - implements JsonFormatVisitorWithSerializerProvider, + implements JsonFormatVisitorWithSerializationContext, SchemaBuilder { - protected SerializerProvider _provider; + protected SerializationContext _provider; @Override public abstract Schema builtAvroSchema(); @Override - public SerializerProvider getProvider() { + public SerializationContext getContext() { return _provider; } @Override - public void setProvider(SerializerProvider provider) { + public void setContext(SerializationContext provider) { _provider = provider; } } diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java b/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java index 80b21a7f7..7a267a379 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java @@ -5,7 +5,7 @@ import tools.jackson.core.JsonGenerator; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.exc.InvalidDefinitionException; import tools.jackson.databind.jsonFormatVisitors.*; import tools.jackson.dataformat.avro.AvroSchema; @@ -15,7 +15,7 @@ public class VisitorFormatWrapperImpl implements JsonFormatVisitorWrapper { - protected SerializerProvider _provider; + protected SerializationContext _context; protected final DefinedSchemas _schemas; @@ -40,15 +40,15 @@ public class VisitorFormatWrapperImpl /********************************************************************** */ - public VisitorFormatWrapperImpl(DefinedSchemas schemas, SerializerProvider p) { + public VisitorFormatWrapperImpl(DefinedSchemas schemas, SerializationContext ctxt) { _schemas = schemas; - _provider = p; + _context = ctxt; } protected VisitorFormatWrapperImpl(VisitorFormatWrapperImpl src) { this._schemas = src._schemas; - this._provider = src._provider; + this._context = src._context; this._logicalTypesEnabled = src._logicalTypesEnabled; } @@ -63,14 +63,14 @@ protected VisitorFormatWrapperImpl createChildWrapper() { } @Override - public SerializerProvider getProvider() { - return _provider; + public SerializationContext getContext() { + return _context; } @Override - public void setProvider(SerializerProvider provider) { - _schemas.setProvider(provider); - _provider = provider; + public void setContext(SerializationContext ctxt) { + _schemas.setContext(ctxt); + _context = ctxt; } protected DefinedSchemas getSchemas() { @@ -96,8 +96,6 @@ public Schema getAvroSchema() { /** * Enables Avro schema with Logical Types generation. - * - * @since 2.13 */ public VisitorFormatWrapperImpl enableLogicalTypes() { _logicalTypesEnabled = true; @@ -106,8 +104,6 @@ public VisitorFormatWrapperImpl enableLogicalTypes() { /** * Disables Avro schema with Logical Types generation. - * - * @since 2.13 */ public VisitorFormatWrapperImpl disableLogicalTypes() { _logicalTypesEnabled = false; @@ -120,8 +116,6 @@ public boolean isLogicalTypesEnabled() { /** * Enable Java enum to Avro string mapping. - * - * @since 2.18 */ public VisitorFormatWrapperImpl enableWriteEnumAsString() { _writeEnumAsString = true; @@ -130,8 +124,6 @@ public VisitorFormatWrapperImpl enableWriteEnumAsString() { /** * Disable Java enum to Avro string mapping. - * - * @since 2.18 */ public VisitorFormatWrapperImpl disableWriteEnumAsString() { _writeEnumAsString = false; @@ -161,14 +153,14 @@ public JsonObjectFormatVisitor expectObjectFormat(JavaType type) { _valueSchema = s; return null; } - RecordVisitor v = new RecordVisitor(_provider, type, this); + RecordVisitor v = new RecordVisitor(_context, type, this); _builder = v; return v; } @Override public JsonMapFormatVisitor expectMapFormat(JavaType mapType) { - MapVisitor v = new MapVisitor(_provider, mapType, this); + MapVisitor v = new MapVisitor(_context, mapType, this); _builder = v; return v; } @@ -183,7 +175,7 @@ public JsonArrayFormatVisitor expectArrayFormat(final JavaType convertedType) { return null; } } - ArrayVisitor v = new ArrayVisitor(_provider, convertedType, this); + ArrayVisitor v = new ArrayVisitor(_context, convertedType, this); _builder = v; return v; } @@ -201,12 +193,12 @@ public JsonStringFormatVisitor expectStringFormat(JavaType type) // 06-Jun-2024: [dataformats-binary#494] Enums may be exposed either // as native Avro Enums, or as Avro Strings: if (type.isEnumType() && !isWriteEnumAsStringEnabled()) { - EnumVisitor v = new EnumVisitor(_provider, _schemas, type); + EnumVisitor v = new EnumVisitor(_context, _schemas, type); _builder = v; return v; } - StringVisitor v = new StringVisitor(_provider, type); + StringVisitor v = new StringVisitor(_context, type); _builder = v; return v; } diff --git a/avro/src/main/java/tools/jackson/dataformat/avro/ser/CustomEncodingSerializer.java b/avro/src/main/java/tools/jackson/dataformat/avro/ser/CustomEncodingSerializer.java index 551d99c39..b8cde52d4 100644 --- a/avro/src/main/java/tools/jackson/dataformat/avro/ser/CustomEncodingSerializer.java +++ b/avro/src/main/java/tools/jackson/dataformat/avro/ser/CustomEncodingSerializer.java @@ -7,7 +7,7 @@ import tools.jackson.databind.JavaType; import tools.jackson.databind.ValueSerializer; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.dataformat.avro.AvroSchema; import tools.jackson.dataformat.avro.CustomEncodingWrapper; @@ -27,7 +27,7 @@ public CustomEncodingSerializer(CustomEncoding encoding) { } @Override - public void serialize(T t, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + public void serialize(T t, JsonGenerator jsonGenerator, SerializationContext ctxt) throws JacksonException { jsonGenerator.writeEmbeddedObject(new CustomEncodingDatum<>(encoding, t)); diff --git a/avro/src/test/java/tools/jackson/dataformat/avro/interop/annotations/CustomSerializationTest.java b/avro/src/test/java/tools/jackson/dataformat/avro/interop/annotations/CustomSerializationTest.java index 4392d4986..37611dfeb 100644 --- a/avro/src/test/java/tools/jackson/dataformat/avro/interop/annotations/CustomSerializationTest.java +++ b/avro/src/test/java/tools/jackson/dataformat/avro/interop/annotations/CustomSerializationTest.java @@ -7,7 +7,7 @@ import tools.jackson.databind.DeserializationContext; import tools.jackson.databind.ValueDeserializer; import tools.jackson.databind.ValueSerializer; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.annotation.JsonDeserialize; import tools.jackson.databind.annotation.JsonSerialize; import org.apache.avro.Schema; @@ -42,7 +42,7 @@ public static class Serializer extends ValueSerializer { @Override public void serialize(final House house, final JsonGenerator g, - final SerializerProvider serializers) + final SerializationContext serializers) { g.writeStartObject(); g.writeName("owner"); diff --git a/avro/src/test/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl_createChildWrapperTest.java b/avro/src/test/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl_createChildWrapperTest.java index 42c199499..49275c257 100644 --- a/avro/src/test/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl_createChildWrapperTest.java +++ b/avro/src/test/java/tools/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl_createChildWrapperTest.java @@ -1,6 +1,6 @@ package tools.jackson.dataformat.avro.schema; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.dataformat.avro.AvroMapper; import tools.jackson.dataformat.avro.AvroTestBase; @@ -15,10 +15,10 @@ public class VisitorFormatWrapperImpl_createChildWrapperTest public void testChildWrapper() { // GIVEN - SerializerProvider serializerProvider = MAPPER._serializerProvider(); + SerializationContext ctxt = MAPPER._serializationContext(); DefinedSchemas schemas = new DefinedSchemas(); - VisitorFormatWrapperImpl src = new VisitorFormatWrapperImpl(schemas, serializerProvider); + VisitorFormatWrapperImpl src = new VisitorFormatWrapperImpl(schemas, ctxt); src.enableLogicalTypes(); // WHEN @@ -27,7 +27,7 @@ public void testChildWrapper() // THEN // All settings are inherited from parent visitor wrapper. Assertions.assertThat(actual.getSchemas()).isEqualTo(schemas); - Assertions.assertThat(actual.getProvider()).isEqualTo(serializerProvider); + Assertions.assertThat(actual.getContext()).isEqualTo(ctxt); Assertions.assertThat(actual.isLogicalTypesEnabled()).isTrue(); } } diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/EnumAsIonSymbolSerializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/EnumAsIonSymbolSerializer.java index 23d1a8be2..fe13f5c9c 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/EnumAsIonSymbolSerializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/EnumAsIonSymbolSerializer.java @@ -19,7 +19,7 @@ import tools.jackson.databind.JavaType; import tools.jackson.databind.SerializationFeature; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.databind.ser.std.StdScalarSerializer; @@ -42,7 +42,7 @@ public EnumAsIonSymbolSerializer() { } @Override - public void serialize(Enum value, JsonGenerator g, SerializerProvider provider) { + public void serialize(Enum value, JsonGenerator g, SerializationContext provider) { if (g instanceof IonGenerator) { String valueString = provider.isEnabled(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) ? value.toString() diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/IonObjectMapper.java b/ion/src/main/java/tools/jackson/dataformat/ion/IonObjectMapper.java index 06c4e01ca..925816eff 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/IonObjectMapper.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/IonObjectMapper.java @@ -302,7 +302,7 @@ public IonParser createParser(IonValue value) { * @since 3.0 */ public IonGenerator createGenerator(IonWriter out) { - return (IonGenerator) tokenStreamFactory().createGenerator(_serializerProvider(), out); + return (IonGenerator) tokenStreamFactory().createGenerator(_serializationContext(), out); } /* @@ -395,7 +395,7 @@ public T readValue(IonValue value, JavaType valueType) throws IOException { * Note: method does not close the underlying writer explicitly */ public void writeValue(IonWriter w, Object value) throws IOException { - SerializationContextExt prov = _serializerProvider(); + SerializationContextExt prov = _serializationContext(); _configAndWriteValue(prov, tokenStreamFactory().createGenerator(prov, w), value); } diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/IonSymbolSerializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/IonSymbolSerializer.java index 128cf09ab..e36f1a305 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/IonSymbolSerializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/IonSymbolSerializer.java @@ -18,7 +18,7 @@ import tools.jackson.core.exc.StreamWriteException; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import tools.jackson.databind.ser.std.StdScalarSerializer; @@ -41,7 +41,7 @@ public IonSymbolSerializer() { } @Override - public void serialize(String value, JsonGenerator g, SerializerProvider provider) { + public void serialize(String value, JsonGenerator g, SerializationContext provider) { if (IonGenerator.class.isAssignableFrom(g.getClass())) { ((IonGenerator) g).writeSymbol(value); } else { diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/IonTimestampSerializers.java b/ion/src/main/java/tools/jackson/dataformat/ion/IonTimestampSerializers.java index b212c0632..3fb6e6a30 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/IonTimestampSerializers.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/IonTimestampSerializers.java @@ -20,7 +20,7 @@ import tools.jackson.core.JsonGenerator; import tools.jackson.databind.SerializationFeature; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.ser.std.StdScalarSerializer; /** @@ -35,10 +35,10 @@ public IonTimestampJavaDateSerializer() { } @Override - public void serialize(java.util.Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + public void serialize(java.util.Date date, JsonGenerator jsonGenerator, SerializationContext ctxt) { // Still respect writing dates as millis if desired - if (serializerProvider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) { + if (ctxt.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) { jsonGenerator.writeNumber(date.getTime()); } else { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); @@ -55,10 +55,10 @@ public IonTimestampSQLDateSerializer() { } @Override - public void serialize(java.sql.Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + public void serialize(java.sql.Date date, JsonGenerator jsonGenerator, SerializationContext ctxt) { // Still respect writing dates as millis if desired - if (serializerProvider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) { + if (ctxt.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) { jsonGenerator.writeNumber(date.getTime()); } else { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/IonValueSerializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/IonValueSerializer.java index 41c0902b0..5377c9605 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/IonValueSerializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/IonValueSerializer.java @@ -15,7 +15,7 @@ package tools.jackson.dataformat.ion.ionvalue; import tools.jackson.core.JsonGenerator; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.ser.std.StdScalarSerializer; import tools.jackson.dataformat.ion.IonGenerator; @@ -31,7 +31,7 @@ public IonValueSerializer() { } @Override - public void serialize(IonValue value, JsonGenerator g, SerializerProvider provider) + public void serialize(IonValue value, JsonGenerator g, SerializationContext provider) { IonGenerator joiGenerator = (IonGenerator) g; joiGenerator.writeValue(value); diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/TimestampSerializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/TimestampSerializer.java index 5072efb65..d6bc88508 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/TimestampSerializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/ionvalue/TimestampSerializer.java @@ -15,7 +15,7 @@ package tools.jackson.dataformat.ion.ionvalue; import tools.jackson.core.JsonGenerator; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.ser.std.StdScalarSerializer; import tools.jackson.dataformat.ion.IonGenerator; @@ -31,7 +31,7 @@ protected TimestampSerializer() { } @Override - public void serialize(Timestamp value, JsonGenerator g, SerializerProvider provider) { + public void serialize(Timestamp value, JsonGenerator g, SerializationContext ctxt) { if (g instanceof IonGenerator) { ((IonGenerator) g).writeValue(value); } else { diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializer.java index 564bb63fa..ca7745ed6 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/jsr310/IonTimestampInstantSerializer.java @@ -18,7 +18,7 @@ import tools.jackson.databind.BeanProperty; import tools.jackson.databind.ValueSerializer; import tools.jackson.databind.SerializationFeature; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.ser.std.StdScalarSerializer; import tools.jackson.dataformat.ion.IonGenerator; @@ -91,7 +91,7 @@ protected IonTimestampInstantSerializer(IonTimestampInstantSerializer base, } @Override - public void serialize(T value, JsonGenerator gen, SerializerProvider provider) + public void serialize(T value, JsonGenerator gen, SerializationContext provider) throws JacksonException { final Instant instant = getInstant.apply(value); @@ -108,7 +108,7 @@ public void serialize(T value, JsonGenerator gen, SerializerProvider provider) } @Override - public ValueSerializer createContextual(SerializerProvider prov, BeanProperty property) + public ValueSerializer createContextual(SerializationContext prov, BeanProperty property) { final JsonFormat.Value format = findFormatOverrides(prov, property, handledType()); if (format != null) { @@ -119,7 +119,7 @@ public ValueSerializer createContextual(SerializerProvider prov, BeanProperty return this; } - private boolean shouldWriteTimestampsAsNanos(SerializerProvider provider) { + private boolean shouldWriteTimestampsAsNanos(SerializationContext provider) { if (Boolean.FALSE.equals(writeDateTimestampsAsNanosOverride)) { return false; } diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeResolverBuilder.java b/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeResolverBuilder.java index 8c71ddbb6..2323d83f8 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeResolverBuilder.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeResolverBuilder.java @@ -20,7 +20,7 @@ import tools.jackson.databind.DeserializationContext; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsontype.NamedType; import tools.jackson.databind.jsontype.TypeDeserializer; import tools.jackson.databind.jsontype.TypeIdResolver; @@ -81,7 +81,7 @@ public Class getDefaultImpl() { * actual object data. */ @Override - public TypeSerializer buildTypeSerializer(SerializerProvider ctxt, JavaType baseType, + public TypeSerializer buildTypeSerializer(SerializationContext ctxt, JavaType baseType, Collection subtypes) { return new IonAnnotationTypeSerializer(typeIdResolver); } diff --git a/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeSerializer.java b/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeSerializer.java index 1dc54b77d..58fbb88ed 100644 --- a/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeSerializer.java +++ b/ion/src/main/java/tools/jackson/dataformat/ion/polymorphism/IonAnnotationTypeSerializer.java @@ -20,7 +20,7 @@ import tools.jackson.core.type.WritableTypeId; import tools.jackson.databind.BeanProperty; import tools.jackson.databind.DatabindContext; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsontype.TypeIdResolver; import tools.jackson.databind.jsontype.TypeSerializer; import tools.jackson.databind.jsontype.impl.TypeSerializerBase; @@ -45,7 +45,7 @@ public class IonAnnotationTypeSerializer extends TypeSerializerBase } @Override - public TypeSerializer forProperty(SerializerProvider ctxt, BeanProperty prop) { + public TypeSerializer forProperty(SerializationContext ctxt, BeanProperty prop) { // We ignore the context information from BeanProperty. return this; } diff --git a/ion/src/test/java/tools/jackson/dataformat/ion/GenerateSexpTest.java b/ion/src/test/java/tools/jackson/dataformat/ion/GenerateSexpTest.java index 7a2a7a0ac..a0a8912a1 100644 --- a/ion/src/test/java/tools/jackson/dataformat/ion/GenerateSexpTest.java +++ b/ion/src/test/java/tools/jackson/dataformat/ion/GenerateSexpTest.java @@ -27,7 +27,7 @@ import com.amazon.ion.system.IonSystemBuilder; import tools.jackson.core.JsonGenerator; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.ValueSerializer; import tools.jackson.databind.annotation.JsonSerialize; @@ -141,7 +141,7 @@ public Object getObjectField() { private static class SexpObjectSerializer extends ValueSerializer { @Override public void serialize(SexpObject value, JsonGenerator jsonGenerator, - SerializerProvider provider) + SerializationContext provider) { final IonGenerator ionGenerator = (IonGenerator) jsonGenerator; diff --git a/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/EnumElementVisitor.java b/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/EnumElementVisitor.java index 98fc41de7..d46aa1b4c 100644 --- a/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/EnumElementVisitor.java +++ b/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/EnumElementVisitor.java @@ -3,7 +3,7 @@ import java.util.Set; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor.Base; import com.squareup.protoparser.EnumConstantElement; import com.squareup.protoparser.EnumElement; @@ -15,7 +15,7 @@ public class EnumElementVisitor extends Base implements TypeElementBuilder { DefaultTagGenerator _tagGenerator = new DefaultTagGenerator(0); - public EnumElementVisitor(SerializerProvider provider, JavaType type, + public EnumElementVisitor(SerializationContext provider, JavaType type, DefinedTypeElementBuilders definedTypeElementBuilders, boolean isNested) { if (!type.isEnumType()) { diff --git a/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/MessageElementVisitor.java b/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/MessageElementVisitor.java index 616915f60..6f47c31b9 100644 --- a/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/MessageElementVisitor.java +++ b/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/MessageElementVisitor.java @@ -28,7 +28,7 @@ public class MessageElementVisitor extends JsonObjectFormatVisitor.Base protected DefinedTypeElementBuilders _definedTypeElementBuilders; - public MessageElementVisitor(SerializerProvider provider, JavaType type, + public MessageElementVisitor(SerializationContext provider, JavaType type, DefinedTypeElementBuilders definedTypeElementBuilders, boolean isNested) { super(provider); @@ -129,7 +129,7 @@ protected DataType getDataType(JavaType type) return NamedType.create(type.getRawClass().getSimpleName()); } - private ProtoBufSchemaVisitor acceptTypeElement(SerializerProvider provider, JavaType type, + private ProtoBufSchemaVisitor acceptTypeElement(SerializationContext provider, JavaType type, DefinedTypeElementBuilders definedTypeElementBuilders, boolean isNested) { // 20-Apr-2018, tatu: not 100% certain if we should get type-wrapped serializer, but diff --git a/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/ProtoBufSchemaVisitor.java b/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/ProtoBufSchemaVisitor.java index 1bc33acc4..b9634ed63 100644 --- a/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/ProtoBufSchemaVisitor.java +++ b/protobuf/src/main/java/tools/jackson/dataformat/protobuf/schemagen/ProtoBufSchemaVisitor.java @@ -5,7 +5,7 @@ import tools.jackson.core.JsonParser.NumberType; import tools.jackson.databind.JavaType; -import tools.jackson.databind.SerializerProvider; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.jsonFormatVisitors.*; import com.squareup.protoparser.DataType; @@ -41,7 +41,7 @@ protected ProtoBufSchemaVisitor() { this(null, new DefinedTypeElementBuilders(), false); } - public ProtoBufSchemaVisitor(SerializerProvider provider, DefinedTypeElementBuilders defBuilders, + public ProtoBufSchemaVisitor(SerializationContext provider, DefinedTypeElementBuilders defBuilders, boolean isNested) { super(provider); @@ -82,7 +82,7 @@ public Set buildWithDependencies() { @Override public JsonObjectFormatVisitor expectObjectFormat(JavaType type) { - MessageElementVisitor visitor = new MessageElementVisitor(_provider, type, _definedTypeElementBuilders, + MessageElementVisitor visitor = new MessageElementVisitor(_context, type, _definedTypeElementBuilders, _isNested); _builder = visitor; _definedTypeElementBuilders.addTypeElement(type, visitor, _isNested); @@ -119,7 +119,7 @@ public JsonArrayFormatVisitor expectArrayFormat(JavaType type) { @Override public JsonStringFormatVisitor expectStringFormat(JavaType type) { if (type.isEnumType()) { - EnumElementVisitor visitor = new EnumElementVisitor(_provider, type, _definedTypeElementBuilders, _isNested); + EnumElementVisitor visitor = new EnumElementVisitor(_context, type, _definedTypeElementBuilders, _isNested); _builder = visitor; _definedTypeElementBuilders.addTypeElement(type, visitor, _isNested); return visitor;