diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java index e8b0370880..09bd316342 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java @@ -274,7 +274,7 @@ protected static EnumValues constructEnumNamingStrategyValues(SerializationConfi annotatedClass); EnumNamingStrategy enumNamingStrategy = EnumNamingStrategyFactory.createEnumNamingStrategyInstance( namingDef, config.canOverrideAccessModifiers()); - return enumNamingStrategy == null ? null : EnumValues.constructUsingEnumNaming( + return enumNamingStrategy == null ? null : EnumValues.constructUsingEnumNamingStrategy( config, enumClass, enumNamingStrategy); } } diff --git a/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java b/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java index 4643c1750f..f7b11f3a46 100644 --- a/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java +++ b/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.EnumNamingStrategy; +import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; /** @@ -153,6 +154,8 @@ private static EnumResolver _constructUsingIndex(Class> enumCls0, Annota * Factory method for constructing resolver that maps the name of enums converted to external property * names into Enum value using an implementation of {@link EnumNamingStrategy}. * + * The output {@link EnumResolver} should contain values that are symmetric to + * {@link EnumValues#constructUsingEnumNamingStrategy(MapperConfig, Class, EnumNamingStrategy)}. * @since 2.15 */ public static EnumResolver constructUsingEnumNamingStrategy(DeserializationConfig config, diff --git a/src/main/java/com/fasterxml/jackson/databind/util/EnumValues.java b/src/main/java/com/fasterxml/jackson/databind/util/EnumValues.java index cbfadd5132..ff2d8618a5 100644 --- a/src/main/java/com/fasterxml/jackson/databind/util/EnumValues.java +++ b/src/main/java/com/fasterxml/jackson/databind/util/EnumValues.java @@ -81,12 +81,13 @@ public static EnumValues constructFromToString(MapperConfig config, Class config, Class> enumClass, EnumNamingStrategy namingStrategy) { + public static EnumValues constructUsingEnumNamingStrategy(MapperConfig config, Class> enumClass, EnumNamingStrategy namingStrategy) { Class> cls = ClassUtil.findEnumType(enumClass); Enum[] values = cls.getEnumConstants(); if (values == null) {