Java Utililty Methods Class Name Get

List of utility methods to do Class Name Get

Description

The list of methods to do Class Name Get are organized into topic(s).

Method

StringclassNameWithType(String className, String type)
class Name With Type
return className + type;
StringgetClassName(Class type)
Map a class object back to a class name.
StringBuffer name = new StringBuffer();
while (type.isArray()) {
    name.append('[');
    type = type.getComponentType();
if (type.isPrimitive()) {
    name.append((String) CLASS_TO_SIGNATURE_MAP.get(type));
else {
    name.append('L');
    name.append(type.getName());
    name.append(';');
return name.toString();
StringgetClassName(Integer typeValue)
get Class Name
return CONVERT_TYPE_MAP.get(typeValue);
StringgetClassName(String string)
get Class Name
List<String> words = Arrays.asList(string.split(" "));
Iterator wordIterator = words.iterator();
while (wordIterator.hasNext())
    if (wordIterator.next().equals("class"))
        return ((String) wordIterator.next()).replace("{", "");
return null;
StringgetClassName(String typeName)
Return the wrapper class name if typeName is a primitive java type, or typeName otherwise.
final Class<?> wrapper = getPrimitiveWrapper(typeName);
return wrapper != null ? wrapper.getSimpleName() : typeName;
StringgetClassName(String upnpDataType)
get Class Name
Class clazz = (Class) dataTypeMap.get(upnpDataType);
if (clazz == null)
    throw new IllegalArgumentException("No class for " + upnpDataType);
return clazz.getName();
StringgetClassNameAsSrc(Class clazz)
Gets the name of the given class as it would be declared in Java source code.
return getClassNameAsSrc(clazz, 0);
StringgetClassNameFromConfig(Object config)
Given the standard configuration block in Yaml, extract the class name Block looks like:
 - class: Something param1: value1 OR - Something 
if (config instanceof String) {
    return (String) config;
} else if (config instanceof Map) {
    Map<String, Object> consumer = (Map<String, Object>) config;
    return (String) consumer.get("class");
} else {
    return null;
ListgetClassNames(StackTraceElement[] currentStack)
get Class Names
ArrayList<String> list = new ArrayList<String>();
for (StackTraceElement element : currentStack) {
    list.add(element.getClassName());
return list;
String[]getClassNames(Class[] ifaces)
get Class Names
List<String> ifaceNames = new ArrayList<String>();
for (Class<?> iface : ifaces) {
    ifaceNames.add(iface.getName());
return ifaceNames.toArray(new String[] {});