mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
if改成Assert.notNull
This commit is contained in:
parent
bfebc8bc0f
commit
65239df0e4
@ -310,7 +310,7 @@ public class EnumUtil {
|
|||||||
*/
|
*/
|
||||||
public static Map<String, Object> getNameFieldMap(final Class<? extends Enum<?>> clazz, final String fieldName) {
|
public static Map<String, Object> getNameFieldMap(final Class<? extends Enum<?>> clazz, final String fieldName) {
|
||||||
final Enum<?>[] enums = clazz.getEnumConstants();
|
final Enum<?>[] enums = clazz.getEnumConstants();
|
||||||
Assert.notNull(enums, "Enum clazz must be not null !");
|
Assert.notNull(enums, "Class [{}] is not an Enum type!", clazz);
|
||||||
final Map<String, Object> map = MapUtil.newHashMap(enums.length, true);
|
final Map<String, Object> map = MapUtil.newHashMap(enums.length, true);
|
||||||
for (final Enum<?> e : enums) {
|
for (final Enum<?> e : enums) {
|
||||||
map.put(e.name(), FieldUtil.getFieldValue(e, fieldName));
|
map.put(e.name(), FieldUtil.getFieldValue(e, fieldName));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user