|
17 | 17 | import com.fasterxml.jackson.core.JsonParser; |
18 | 18 | import com.fasterxml.jackson.core.JsonProcessingException; |
19 | 19 | import com.fasterxml.jackson.databind.*; |
| 20 | +import com.fasterxml.jackson.databind.cfg.MapperConfig; |
20 | 21 | import com.fasterxml.jackson.databind.introspect.AnnotatedClass; |
21 | 22 | import com.fasterxml.jackson.databind.introspect.AnnotatedConstructor; |
22 | 23 | import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; |
@@ -72,14 +73,6 @@ public abstract class AvroSchemaHelper |
72 | 73 | String.class |
73 | 74 | )); |
74 | 75 |
|
75 | | - /** |
76 | | - * |
77 | | - * Jackson annotation introspector for verifying enum default annotation for Avro Schema generation |
78 | | - * |
79 | | - * @since 2.16 |
80 | | - */ |
81 | | - private static final JacksonAnnotationIntrospector JACKSON_ANNOTATION_INTROSPECTOR = new JacksonAnnotationIntrospector(); |
82 | | - |
83 | 76 | /** |
84 | 77 | * Checks if a given type is "Stringable", that is one of the default |
85 | 78 | * {@code STRINGABLE_CLASSES}, is an {@code Enum}, |
@@ -276,9 +269,10 @@ public static Schema parseJsonSchema(String json) { |
276 | 269 | * @param values List of enum names |
277 | 270 | * @return An {@link org.apache.avro.Schema.Type#ENUM ENUM} schema. |
278 | 271 | */ |
279 | | - public static Schema createEnumSchema(BeanDescription bean, List<String> values) { |
| 272 | + public static Schema createEnumSchema(BeanDescription bean, List<String> values, |
| 273 | + AnnotationIntrospector intr) { |
280 | 274 | final JavaType enumType = bean.getType(); |
281 | | - Enum<?> defaultEnumValue = JACKSON_ANNOTATION_INTROSPECTOR.findDefaultEnumValue((Class<Enum<?>>)(Class<?>) enumType.getRawClass()); |
| 275 | + Enum<?> defaultEnumValue = intr.findDefaultEnumValue((Class<Enum<?>>)(Class<?>) enumType.getRawClass()); |
282 | 276 | return addAlias(Schema.createEnum( |
283 | 277 | getName(enumType), |
284 | 278 | bean.findClassDescription(), |
|
0 commit comments