List of utility methods to do Class Name Get
String | classNameWithType(String className, String type) class Name With Type return className + type;
|
String | getClassName(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(); |
String | getClassName(Integer typeValue) get Class Name return CONVERT_TYPE_MAP.get(typeValue);
|
String | getClassName(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; |
String | getClassName(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; |
String | getClassName(String upnpDataType) get Class Name Class clazz = (Class) dataTypeMap.get(upnpDataType); if (clazz == null) throw new IllegalArgumentException("No class for " + upnpDataType); return clazz.getName(); |
String | getClassNameAsSrc(Class> clazz) Gets the name of the given class as it would be declared in Java source code. return getClassNameAsSrc(clazz, 0);
|
String | getClassNameFromConfig(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; |
List | getClassNames(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[] {}); |