Java Class to Primitive getPrimitiveWrapper(Class c)

Here you can find the source of getPrimitiveWrapper(Class c)

Description

If the specified class is a primitive (e.g.

License

Apache License

Parameter

Parameter Description
c The class.

Return

The wrapper class, or null if class is not a primitive.

Declaration

public static Class<?> getPrimitiveWrapper(Class<?> c) 

Method Source Code

//package com.java2s;
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *

import java.util.*;

public class Main {
    private final static Map<Class<?>, Class<?>> pmap1 = new HashMap<Class<?>, Class<?>>(),
            pmap2 = new HashMap<Class<?>, Class<?>>();

    /**//  w  ww .j av  a  2s .co  m
     * If the specified class is a primitive (e.g. <code><jk>int</jk>.<jk>class</jk></code>)
     *    returns it's wrapper class (e.g. <code>Integer.<jk>class</jk></code>).
     *
     * @param c The class.
     * @return The wrapper class, or <jk>null</jk> if class is not a primitive.
     */
    public static Class<?> getPrimitiveWrapper(Class<?> c) {
        return pmap1.get(c);
    }
}

Related

  1. getPrimitiveClass(String name)
  2. getPrimitiveDftValue(Class clazz)
  3. getPrimitiveTypeByWrapper(Class clazz)
  4. getWrapper(String primitiveClassName)
  5. getWrapperTypeByPrimitive(Class clazz)
  6. primitiveToWrapper(Class cls)
  7. primitiveToWrapper(Class in)