修改 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)); 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) { public static <E extends Enum<?>> Integer checkOrdinalNullable(Class<E> clazz, @Nullable Integer ordinal) {
return checkOrdinalOrDefault(clazz, ordinal, null); 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) { public static <E extends Enum<?>> Integer checkOrdinalOrDefault(Class<E> clazz, @Nullable Integer ordinal) {
return checkOrdinalOrDefault(clazz, ordinal, 0); return checkOrdinalOrDefault(clazz, ordinal, 0);
} }
/**
* ordinal ordinal {@code null} {@code defaultValue}
*
* @param <E>
* @param clazz
* @param ordinal The ordinal
* @return The ordinal
*/
@Nullable @Nullable
@Deprecated
public static <E extends Enum<?>> Integer checkOrdinalOrDefault( public static <E extends Enum<?>> Integer checkOrdinalOrDefault(
Class<E> clazz, Class<E> clazz,
@Nullable Integer ordinal, @Nullable Integer ordinal,