使用 AssertTools 代替 PreconditionsExt。

This commit is contained in:
2024-10-11 17:11:06 +08:00
parent 304dccc658
commit b72fd59b46
4 changed files with 72 additions and 115 deletions

View File

@@ -46,7 +46,7 @@ public final class EnumTools {
public static <E extends Enum<?>> E valueOf(Class<E> clazz, int ordinal) { // NOSONAR 该方法弃用,但不删掉
Preconditions.checkNotNull(clazz, "Clazz must not be null.");
E[] values = clazz.getEnumConstants();
PreconditionsExt.checkCondition((ordinal >= 0 && ordinal < values.length),
AssertTools.checkCondition((ordinal >= 0 && ordinal < values.length),
() -> new EnumConstantNotPresentException(clazz, Integer.toString(ordinal)));
return values[ordinal];
}