if改成Assert.notNull

This commit is contained in:
VampireAchao 2023-02-16 09:57:36 +08:00
parent 2becd707b6
commit bfebc8bc0f

View File

@ -310,9 +310,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) {
throw new IllegalArgumentException(StrUtil.format("Class [{}] is not an Enum type!", clazz.getName()));
}
Assert.notNull(enums, "Enum clazz must be not null !");
final Map<String, Object> map = MapUtil.newHashMap(enums.length, true);
for (final Enum<?> e : enums) {
map.put(e.name(), FieldUtil.getFieldValue(e, fieldName));