List of utility methods to do Class Simple Name Get
String | simpleClassName(Class cl) simple Class Name String scn; int array_level = 0; while (cl.isArray()) { ++array_level; cl = cl.getComponentType(); scn = simpleClassName(cl.getName()); if (array_level > 0) { ... |
String | simpleClassName(Class klass) simple Class Name String class_name = klass.getName(); if (klass.getPackage() != null) { class_name = class_name.substring(klass.getPackage().getName().length() + 1); return class_name; |
String | simpleClassName(Class> clazz) simple Class Name Package pkg = clazz.getPackage(); String result; if (pkg == null) result = clazz.getName(); else result = clazz.getName().substring(pkg.getName().length() + 1); return result; |
String | simpleClassName(Class> clazz) Generates a simplified name from a Class . if (clazz == null) { return "null_class"; Package pkg = clazz.getPackage(); if (pkg != null) { return clazz.getName().substring(pkg.getName().length() + 1); } else { return clazz.getName(); ... |
String | simpleClassName(Class> clazz) simple Class Name if (clazz == null) { throw new NullPointerException("clazz"); String className = clazz.getName(); final int lastDotIdx = className.lastIndexOf(PACKAGE_SEPARATOR_CHAR); if (lastDotIdx > -1) { return className.substring(lastDotIdx + 1); return className; |
String | simpleClassName(Class> type) simple Class Name String className = type.getName(); int dot = className.lastIndexOf("."); if (dot >= 0) className = className.substring(dot + 1); dot = className.lastIndexOf("$"); if (dot >= 0) className = className.substring(dot + 1); return className; ... |
String | simpleClassName(final String className) Returns the simple class name from the fully qualified class name. assert className != null : "className must not be null"; assert !className.isEmpty() : "className must not be empty"; final int index = className.lastIndexOf('.'); assert index > -1 : "cannot find package in import " + className; return className.substring(index + 1); |
String | simpleClassName(Object o) The shortcut to #simpleClassName(Class) simpleClassName(o.getClass()) . return simpleClassName(o.getClass());
|
String | simpleClassName(Object o) simple Class Name if (o == null) return null; return (o instanceof Class ? ((Class<?>) o).getName() : o.getClass().getSimpleName()); |
String | simpleClassName(Object object) simple Class Name if (object == null) { return "null_object"; Class clazz = object.getClass(); Package pkg = clazz.getPackage(); if (pkg != null) { return clazz.getName().substring(pkg.getName().length() + 1); } else { ... |