Here you can find the source of isPrimitiveWrapperArray(Class clazz)
Parameter | Description |
---|---|
clazz | the class to check |
public static boolean isPrimitiveWrapperArray(Class clazz)
//package com.java2s; /**//ww w.ja v a2 s .c o m * * Copyright 2008-2009 (C) The original author or authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.HashMap; import java.util.Map; public class Main { /** * Map with primitive wrapper type as key and corresponding primitive * type as value, for example: Integer.class -> int.class. */ private static final Map primitiveWrapperTypeMap = new HashMap(8); /** * Check if the given class represents an array of primitive wrappers, * i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double. * * @param clazz the class to check * @return whether the given class is a primitive wrapper array class */ public static boolean isPrimitiveWrapperArray(Class clazz) { if (clazz == null) throw new IllegalArgumentException("Class must not be null"); return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType())); } /** * Check if the given class represents a primitive wrapper, * i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double. * * @param clazz the class to check * @return whether the given class is a primitive wrapper class */ public static boolean isPrimitiveWrapper(Class clazz) { if (clazz == null) throw new IllegalArgumentException("Class must not be null"); return primitiveWrapperTypeMap.containsKey(clazz); } }