Java Class Name Get getClassName(String typeName)

Here you can find the source of getClassName(String typeName)

Description

Return the wrapper class name if typeName is a primitive java type, or typeName otherwise.

License

Open Source License

Declaration

public static String getClassName(String typeName) 

Method Source Code

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

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

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

    /**/* www  .j a va2  s .  c  o m*/
     * Return the wrapper class name if typeName is a primitive java type, or typeName otherwise.
     */
    public static String getClassName(String typeName) {
        final Class<?> wrapper = getPrimitiveWrapper(typeName);
        return wrapper != null ? wrapper.getSimpleName() : typeName;
    }

    public static Class<?> getPrimitiveWrapper(String primitiveTypeName) {
        return primitiveWrappers.get(primitiveTypeName);
    }
}

Related

  1. classNameSubPackage(String className)
  2. classNameWithType(String className, String type)
  3. getClassName(Class type)
  4. getClassName(Integer typeValue)
  5. getClassName(String string)
  6. getClassName(String upnpDataType)
  7. getClassNameAsSrc(Class clazz)
  8. getClassNameFromConfig(Object config)
  9. getClassNames( StackTraceElement[] currentStack)