Here you can find the source of getWrapperClass(Class> clazz)
Parameter | Description |
---|---|
clazz | a parameter |
public static Class<?> getWrapperClass(Class<?> clazz)
//package com.java2s; /*//w w w . j a va 2 s. c om * Copyright (c) 2007-2016 Centimia Ltd. * All rights reserved. Unpublished -- rights reserved * * Use of a copyright notice is precautionary only, and does * not imply publication or disclosure. * * Multiple-Licensed under the H2 License, * Version 1.0, and under the Eclipse Public License, Version 1.0 * (http://h2database.com/html/license.html). * Initial Developer: H2 Group, Centimia Inc. */ import java.util.HashMap; public class Main { private static HashMap<Class<?>, Class<?>> map = new HashMap<Class<?>, Class<?>>(); /** * returns the Object Type class of a primitive class type. i.e. int.class returns Integer.class * @param clazz * @return Class<?> */ public static Class<?> getWrapperClass(Class<?> clazz) { if (clazz.isPrimitive()) return map.get(clazz); return clazz; } }