Here you can find the source of isExtPrimitive(Class> clazz)
Parameter | Description |
---|---|
clazz | The class of the type to query. |
public static boolean isExtPrimitive(Class<?> clazz)
//package com.java2s; /**/*from w w w . j ava 2 s .c o m*/ * Copyright 2011 The Open Source Research Group, * University of Erlangen-N?rnberg * * 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 { private static final Map<Class<?>, Class<?>> ucToLcTypeMap = new HashMap<Class<?>, Class<?>>(); /** * Class.isPrimitive only works for the built-in Java types (eg. int, * boolean). This method only works for the "uppercase" variants of Java's * primitive types (eg. Integer, Boolean, ...). * * @param clazz * The class of the type to query. * @return True if it's a "real" primitive data type of one of the * "uppercase" variants, false otherwise. */ public static boolean isExtPrimitive(Class<?> clazz) { return ucToLcTypeMap.containsKey(clazz); } }