All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rschmitt.dynamicobject.Primitives Maven / Gradle / Ivy

package com.github.rschmitt.dynamicobject;

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

/*
 * This class deals with the primitive types that need to be boxed and unboxed.
 */
class Primitives {
    private static final Map, Class> unboxedToBoxed;

    static {
        Map, Class> mapping = new HashMap<>();
        mapping.put(boolean.class, Boolean.class);
        mapping.put(char.class, Character.class);
        mapping.put(byte.class, Byte.class);
        mapping.put(short.class, Short.class);
        mapping.put(int.class, Integer.class);
        mapping.put(long.class, Long.class);
        mapping.put(float.class, Float.class);
        mapping.put(double.class, Double.class);
        unboxedToBoxed = mapping;
    }

    static Class box(Class type) {
        return unboxedToBoxed.getOrDefault(type, type);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy