Java Type Convert typeToTag(String TheType)

Here you can find the source of typeToTag(String TheType)

Description

{ method

License

Apache License

Parameter

Parameter Description
TheType class name

Return

the tag string }

Declaration

public static String typeToTag(String TheType) 

Method Source Code

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

public class Main {
    /**//  w ww .j  ava2 s . c  om
     * { field
     *
     * @name gPrimativeTypes
     * @function names of java primative types
     * }
     */
    protected static final String gPrimativeTypes[] = { "int", "float", "boolean", "double", "byte", "char",
            "short", "long" };

    /**
     * { method
     *
     * @param TheType class name
     * @return the tag string
     *         }
     * @name typeToTag
     * @function convert a class name to tag for HTML documentation - primative
     * types return unaltered
     */
    public static String typeToTag(String TheType) {
        if (isPrimitiveType(TheType)) {
            return (TheType);
        } else {
            return ("<a href=\"" + TheType + ".html#_top_" + "\">" + TheType + "</a>");
        }
    }

    /**
     * { method
     *
     * @param ClassName name
     * @return true is primative
     *         }
     * @name isPrimitiveType
     * @function true if name is a primative type i.e. int, String
     */
    public static boolean isPrimitiveType(String ClassName) {
        for (int i = 0; i < gPrimativeTypes.length; i++) {
            if (ClassName.equals(gPrimativeTypes[i])) {
                return (true);
            }
        }
        return (false);
    }
}

Related

  1. typeToSignature(String className)
  2. typeToSignature(String type)
  3. typeToSimpleName(String typeName)
  4. TypeToString(int typeNum)
  5. typeToString(Object o)
  6. typeToTyperef(Class type)
  7. typeToUnboxedType(Class type)
  8. typeToVMSignature(final String type)