Skip to content

Commit d3e0f4d

Browse files
committed
Consider enum subclasses as simple value types as well
Issue: SPR-16278
1 parent 9beb978 commit d3e0f4d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-beans/src/main/java/org/springframework/beans/BeanUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -561,13 +561,14 @@ public static boolean isSimpleProperty(Class<?> clazz) {
561561

562562
/**
563563
* Check if the given type represents a "simple" value type:
564-
* a primitive, a String or other CharSequence, a Number, a Date,
564+
* a primitive, an enum, a String or other CharSequence, a Number, a Date,
565565
* a URI, a URL, a Locale or a Class.
566566
* @param clazz the type to check
567567
* @return whether the given type represents a "simple" value type
568568
*/
569569
public static boolean isSimpleValueType(Class<?> clazz) {
570-
return (ClassUtils.isPrimitiveOrWrapper(clazz) || clazz.isEnum() ||
570+
return (ClassUtils.isPrimitiveOrWrapper(clazz) ||
571+
Enum.class.isAssignableFrom(clazz) ||
571572
CharSequence.class.isAssignableFrom(clazz) ||
572573
Number.class.isAssignableFrom(clazz) ||
573574
Date.class.isAssignableFrom(clazz) ||

0 commit comments

Comments
 (0)