From 525dc30294b89770b221ddf46a44635a10d1b802 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 4 Jan 2025 16:10:30 -0800 Subject: [PATCH] Add Javadocs, default settings constants, for AvroSchemaGenerator --- .../avro/schema/AvroSchemaGenerator.java | 3 +++ .../avro/schema/VisitorFormatWrapperImpl.java | 21 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/AvroSchemaGenerator.java b/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/AvroSchemaGenerator.java index 81faebbbd..debc6f726 100644 --- a/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/AvroSchemaGenerator.java +++ b/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/AvroSchemaGenerator.java @@ -8,6 +8,9 @@ * An instance is typically given to * {@link com.fasterxml.jackson.databind.ObjectMapper#acceptJsonFormatVisitor} * which will invoke necessary callbacks. + *

+ * For default configuration of things like "Logical Types support", see Javadocs + * of {@link VisitorFormatWrapperImpl}. */ public class AvroSchemaGenerator extends VisitorFormatWrapperImpl { diff --git a/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java b/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java index 247d6b816..71625d8bf 100644 --- a/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java +++ b/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/VisitorFormatWrapperImpl.java @@ -17,6 +17,23 @@ public class VisitorFormatWrapperImpl implements JsonFormatVisitorWrapper { + /** + * Default value for {@link #_logicalTypesEnabled}: for Jackson 2.x + * {@code false} for backwards-compatibility; will be changed to + * {@code true} in 3.0. + * + * @since 2.19 + */ + public static final boolean DEFAULT_LOGICAL_TYPES_ENABLED = false; + + /** + * Default value for {@link #_writeEnumAsString}: {@code false} as of + * Jackson 2.19 and later. + * + * @since 2.19 + */ + public static final boolean DEFAULT_ENUM_AS_STRING = false; + protected SerializerProvider _provider; protected final DefinedSchemas _schemas; @@ -24,7 +41,7 @@ public class VisitorFormatWrapperImpl /** * @since 2.13 */ - protected boolean _logicalTypesEnabled = false; + protected boolean _logicalTypesEnabled = DEFAULT_LOGICAL_TYPES_ENABLED; /** * @since 2.18 @@ -53,11 +70,11 @@ public VisitorFormatWrapperImpl(DefinedSchemas schemas, SerializerProvider p) { _provider = p; } - protected VisitorFormatWrapperImpl(VisitorFormatWrapperImpl src) { this._schemas = src._schemas; this._provider = src._provider; this._logicalTypesEnabled = src._logicalTypesEnabled; + this._writeEnumAsString = src._writeEnumAsString; } /**