Returns whether the given class is a primitive type or its wrapper class. @param clazz The class to check @return true if the class is a primitive or wrapper type, false otherwise
(Class<?> clazz)
| 277 | * @return {@code true} if the class is a primitive or wrapper type, {@code false} otherwise |
| 278 | */ |
| 279 | public static boolean isPrimitive(Class<?> clazz) { |
| 280 | if (clazz.isPrimitive()) { |
| 281 | return true; |
| 282 | } else { |
| 283 | return clazz.equals(Boolean.class) || clazz.equals(Byte.class) || clazz.equals(Character.class) || |
| 284 | clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Integer.class) || |
| 285 | clazz.equals(Long.class) || clazz.equals(Short.class); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | |
| 290 | /** |
no test coverage detected