List of utility methods to do Class Name Get
String | classname(Class javaClass) classname String jClassName = javaClass.getName();
return classname(jClassName);
|
String | className(Class type) Returns the class formatted as a string. if (type.isArray()) { Class elementClass = getElementClass(type); StringBuilder buffer = new StringBuilder(16); for (int i = 0, n = getDimensionCount(type); i < n; i++) buffer.append("[]"); return className(elementClass) + buffer; if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class ... |
String | className(Class> aClass) class Name if (aClass == null) return null; final String cn = aClass.getName(); int idx = cn.lastIndexOf('.'); return (idx > 0) ? cn.substring(idx + 1) : cn; |
String | className(final Class> c) Get an easy-to-use representation of a class. String s; if (c == null) { return "No class specified."; s = c.getCanonicalName(); if ((s != null) && (s.length() > 0)) { return s; s = c.getName(); if ((s != null) && (s.length() > 0)) { return s; s = c.getSimpleName(); if ((s != null) && (s.length() > 0)) { return s; s = c.toString(); if ((s != null) && (s.length() > 0)) { return s; return "nameless"; |
String | className(final Object object) Returns the class name of the specified object, excluding its path. return className(object.getClass());
|
String | className(Object o) class Name if (o == null) { return ""; String s = o.getClass().getName(); int i = s.lastIndexOf('.'); if (i >= 0) { return s.substring(i + 1); } else { ... |
String | className(Object o) Readable class name (i.e., not unqualified) if (null == o) { return "NOCLASS"; if (o instanceof Class) { return ((Class<?>) o).getSimpleName(); return o.getClass().getSimpleName(); |
String | className(Object obj) class Name return classShortName(obj.getClass());
|
String | classname(Object obj) classname if (obj != null && obj.getClass().getEnclosingClass() == null) { return obj.getClass().getSimpleName(); } else { return null; |
String | className(Object object) null safe classname method return object == null ? null : object.getClass().getName();
|