修改 EnumUtil。

feature/net-util
ZhouXY108 2023-06-25 11:17:46 +08:00
parent 18ea5d9136
commit ebcd02144c
1 changed files with 26 additions and 3 deletions

View File

@ -130,18 +130,41 @@ public final class EnumUtil {
throw new EnumConstantNotPresentException(clazz, Integer.toString(ordinal));
}
@Deprecated
/**
* ordinal
*
* @param <E>
* @param clazz
* @param ordinal The ordinal
* @return The ordinal
*/
@Nullable
public static <E extends Enum<?>> Integer checkOrdinalNullable(Class<E> clazz, @Nullable Integer ordinal) {
return checkOrdinalOrDefault(clazz, ordinal, null);
}
@Deprecated
/**
* ordinal ordinal {@code null} {@code 0}
*
* @param <E>
* @param clazz
* @param ordinal The ordinal
* @return The ordinal
*/
@Nullable
public static <E extends Enum<?>> Integer checkOrdinalOrDefault(Class<E> clazz, @Nullable Integer ordinal) {
return checkOrdinalOrDefault(clazz, ordinal, 0);
}
/**
* ordinal ordinal {@code null} {@code defaultValue}
*
* @param <E>
* @param clazz
* @param ordinal The ordinal
* @return The ordinal
*/
@Nullable
@Deprecated
public static <E extends Enum<?>> Integer checkOrdinalOrDefault(
Class<E> clazz,
@Nullable Integer ordinal,