Java Reflection Primitive getPrimitiveClass(String name)

Here you can find the source of getPrimitiveClass(String name)

Description

Returns the primitive class object that matches the specified type name.
Returns null if the name does not match a primitive type.

License

Open Source License

Parameter

Parameter Description
name the type name

Return

the primimitive class object or null

Declaration

public static Class getPrimitiveClass(String name) 

Method Source Code


//package com.java2s;

import java.util.Map;

public class Main {
    private static Map primitiveClasses;

    /**/* w w  w  .j  a  va  2  s .c om*/
     * Returns the primitive class object that matches the specified type name.<br>
     * Returns null if the name does not match a primitive type.
     *
     * @param name the type name
     * @return the primimitive class object or null
     */
    public static Class getPrimitiveClass(String name) {
        return (Class) primitiveClasses.get(name);
    }
}

Related

  1. getNullOrPrimitiveDefault(Class to)
  2. getPrimitive(final String classname)
  3. getPrimitiveClass(Class wrapper)
  4. getPrimitiveClass(Class wrapperClazz)
  5. getPrimitiveClass(Class boxedClass)
  6. getPrimitiveClass(String primitiveClassName)
  7. getPrimitiveClass(String primitiveName)
  8. getPrimitiveClassIfWrapper(Class clazz)
  9. getPrimitiveDefault(Class primitiveClazz)