Skip to content

Commit

Permalink
Minor tweaks post #4025
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 12, 2023
1 parent d764ead commit b14168d
Showing 1 changed file with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,24 @@ public void findEnumAliases(MapperConfig<?> config, AnnotatedClass annotatedClas
return;
}

/**
* Finds the first Enum value that should be considered as default value
* for unknown Enum values, if present.
*
* @param ac The Enum class to scan for the default value.
* @param enumValues The Enum values of the Enum class.
* @return null if none found or it's not possible to determine one.
*
* @since 2.16
*/
public Enum<?> findDefaultEnumValue(AnnotatedClass ac, Enum<?>[] enumValues) {
// 11-Jul-2023, tatu: [databind#4025] redirect to old method for now (to
// help backwards compatibility)
@SuppressWarnings("unchecked")
Class<Enum<?>> enumCls = (Class<Enum<?>>) ac.getRawType();
return findDefaultEnumValue(enumCls);
}

/**
* Finds the Enum value that should be considered the default value, if possible.
*
Expand All @@ -1181,21 +1199,6 @@ public Enum<?> findDefaultEnumValue(Class<Enum<?>> enumCls) {
return null;
}

/**
* Finds the first Enum value that should be considered as default value
* for unknown Enum values, if present.
* <p>
* Note that this implementation directly relies on {@link JsonEnumDefaultValue} annotation.
*
* @param annotatedClass The Enum class to scan for the default value.
* @param enumValues The Enum values of the Enum class.
* @return null if none found or it's not possible to determine one.
* @since 2.16
*/
public Enum<?> findDefaultEnumValue(AnnotatedClass annotatedClass, Enum<?>[] enumValues) {
return null;
}

/**
* Method for determining the String value to use for serializing
* given enumeration entry; used when serializing enumerations
Expand Down

0 comments on commit b14168d

Please sign in to comment.