Java Class Name Convert To classNameToWrapperName(String ClassName)

Here you can find the source of classNameToWrapperName(String ClassName)

Description

convert the input class to a wrapper class returns in if the argument is not primitive

License

Apache License

Parameter

Parameter Description
in non-null class

Return

non-null class guaranteed not to be primitive

Declaration

public static String classNameToWrapperName(String ClassName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from  w w w  .  j  a v  a2s.  c  o  m
     * { field
     *
     * @name gPrimativeTypes
     * @function names of java primative types
     * }
     */
    protected static final String gPrimativeTypes[] = { "int", "float", "boolean", "double", "byte", "char",
            "short", "long" };
    /**
     * { field
     *
     * @name gWrapperTypes
     * @function list of java wrapper classes corresponding to primative types
     * }
     */
    protected static final String gWrapperTypes[] = { "Integer", "Float", "Boolean", "Double", "Byte", "Character",
            "Integer", "Long" };

    /**
     * convert the input class to a wrapper class
     * returns in if the argument is not primitive
     *
     * @param in non-null class
     * @return non-null class guaranteed not to be primitive
     */
    public static String classNameToWrapperName(String ClassName) {
        for (int i = 0; i < gPrimativeTypes.length; i++) {
            if (ClassName.equals(gPrimativeTypes[i])) {
                return (gWrapperTypes[i]);
            }
        }
        return (ClassName);
    }
}

Related

  1. classNameToPath(String className)
  2. classNameToResource(String className)
  3. classNameToResource(String className)
  4. classNameToResourceKey(String name)
  5. classNameToResourceName(String clsName)