Merge branch '5.1.x'

This commit is contained in:
Sam Brannen
2019-09-03 14:21:39 +02:00
4 changed files with 55 additions and 7 deletions

View File

@@ -121,6 +121,7 @@ public abstract class ClassUtils {
primitiveWrapperTypeMap.put(Integer.class, int.class);
primitiveWrapperTypeMap.put(Long.class, long.class);
primitiveWrapperTypeMap.put(Short.class, short.class);
primitiveWrapperTypeMap.put(Void.class, void.class);
// Map entry iteration is less expensive to initialize than forEach with lambdas
for (Map.Entry<Class<?>, Class<?>> entry : primitiveWrapperTypeMap.entrySet()) {
@@ -463,7 +464,8 @@ public abstract class ClassUtils {
/**
* Check if the given class represents a primitive wrapper,
* i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double.
* i.e. Boolean, Byte, Character, Short, Integer, Long, Float, Double, or
* Void.
* @param clazz the class to check
* @return whether the given class is a primitive wrapper class
*/
@@ -474,10 +476,12 @@ public abstract class ClassUtils {
/**
* Check if the given class represents a primitive (i.e. boolean, byte,
* char, short, int, long, float, or double) or a primitive wrapper
* (i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double).
* char, short, int, long, float, or double), {@code void}, or a wrapper for
* those types (i.e. Boolean, Byte, Character, Short, Integer, Long, Float,
* Double, or Void).
* @param clazz the class to check
* @return whether the given class is a primitive or primitive wrapper class
* @return {@code true} if the given class represents a primitive, void, or
* a wrapper class
*/
public static boolean isPrimitiveOrWrapper(Class<?> clazz) {
Assert.notNull(clazz, "Class must not be null");