使用抛出异常方式代替null

This commit is contained in:
VampireAchao 2023-02-13 21:37:54 +08:00
parent fdffcbfe7c
commit 2becd707b6

View File

@ -311,7 +311,7 @@ public class EnumUtil {
public static Map<String, Object> getNameFieldMap(final Class<? extends Enum<?>> clazz, final String fieldName) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return Collections.emptyMap();
throw new IllegalArgumentException(StrUtil.format("Class [{}] is not an Enum type!", clazz.getName()));
}
final Map<String, Object> map = MapUtil.newHashMap(enums.length, true);
for (final Enum<?> e : enums) {