Java Reflection Primitive isPrimitiveWrapper(final Class type)

Here you can find the source of isPrimitiveWrapper(final Class type)

Description

Returns whether the given type is a primitive wrapper ( Boolean , Byte , Character , Short , Integer , Long , Double , Float ).

License

Open Source License

Parameter

Parameter Description
type The class to query or null.

Return

true if the given type is a primitive wrapper ( , , , , , , , ).

Declaration

public static boolean isPrimitiveWrapper(final Class<?> type) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.HashMap;
import java.util.Map;

public class Main {
    /**/*  ww w.  j av  a 2  s .co m*/
     * Maps wrapper {@code Class}es to their corresponding primitive types.
     */
    private static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = new HashMap<Class<?>, Class<?>>();

    /**
     * Returns whether the given {@code type} is a primitive wrapper ({@link Boolean}, {@link Byte}, {@link Character}, {@link Short},
     * {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
     *
     * @param type
     *            The class to query or null.
     * @return true if the given {@code type} is a primitive wrapper ({@link Boolean}, {@link Byte}, {@link Character}, {@link Short},
     *         {@link Integer}, {@link Long}, {@link Double}, {@link Float}).
     * @since 3.1
     */
    public static boolean isPrimitiveWrapper(final Class<?> type) {
        return wrapperPrimitiveMap.containsKey(type);
    }
}

Related

  1. isPrimitiveOrWrapper(Class type)
  2. isPrimitiveOrWrapper(final Class type)
  3. isPrimitiveWrapper(Class clazz)
  4. isPrimitiveWrapper(Class clazz)
  5. isPrimitiveWrapper(Class klass)
  6. isPrimitiveWrapperArray(Class clazz)
  7. isPrimitiveWrapperClass(Class primitiveWrapperClass)
  8. isWrapper(Class clazz)
  9. isWrapper(Class dataType)