Skip to content

Commit 6f6ff33

Browse files
committed
Consider enum subclasses as simple value types as well
Issue: SPR-16278 (cherry picked from commit d3e0f4d)
1 parent 4bb8375 commit 6f6ff33

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-2016 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.
@@ -506,13 +506,14 @@ public static boolean isSimpleProperty(Class<?> clazz) {
506506

507507
/**
508508
* Check if the given type represents a "simple" value type:
509-
* a primitive, a String or other CharSequence, a Number, a Date,
509+
* a primitive, an enum, a String or other CharSequence, a Number, a Date,
510510
* a URI, a URL, a Locale or a Class.
511511
* @param clazz the type to check
512512
* @return whether the given type represents a "simple" value type
513513
*/
514514
public static boolean isSimpleValueType(Class<?> clazz) {
515-
return (ClassUtils.isPrimitiveOrWrapper(clazz) || clazz.isEnum() ||
515+
return (ClassUtils.isPrimitiveOrWrapper(clazz) ||
516+
Enum.class.isAssignableFrom(clazz) ||
516517
CharSequence.class.isAssignableFrom(clazz) ||
517518
Number.class.isAssignableFrom(clazz) ||
518519
Date.class.isAssignableFrom(clazz) ||

0 commit comments

Comments
 (0)