Here you can find the source of isWrapper(Class> clazz)
Parameter | Description |
---|---|
clazz | the class type to check. |
true
if given class type is wrapper class; false
otherwise.
public static boolean isWrapper(Class<?> clazz)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.List; public class Main { /** Constant for array of wrapper (object) types. */ @SuppressWarnings("rawtypes") //@formatter:off private static final List<Class> wrappers = Arrays.asList(new Class[] { Integer.class, Double.class, Byte.class, Boolean.class, Character.class, Void.class, Short.class, Float.class, Long.class }); /**/* w ww .j ava 2 s. c om*/ * Returns information whether the given class is the wrapper class. * * @param clazz the class type to check. * @return <code>true</code> if given class type is wrapper class; <code>false</code> otherwise. */ public static boolean isWrapper(Class<?> clazz) { return wrappers.contains(clazz); } }