forked from plusone/plusone-commons
修改方法名。
This commit is contained in:
@@ -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.check((ordinal >= 0 && ordinal < values.length),
|
||||
PreconditionsExt.checkCondition((ordinal >= 0 && ordinal < values.length),
|
||||
() -> new EnumConstantNotPresentException(clazz, Integer.toString(ordinal)));
|
||||
return values[ordinal];
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ import com.google.common.base.Preconditions;
|
||||
*/
|
||||
public class PreconditionsExt {
|
||||
|
||||
public static <E extends Throwable> void check(boolean condition, @Nonnull Supplier<E> e) throws E {
|
||||
public static <E extends Throwable> void checkCondition(boolean condition, @Nonnull Supplier<E> e) throws E {
|
||||
if (!condition) {
|
||||
throw e.get();
|
||||
}
|
||||
|
Reference in New Issue
Block a user