List of utility methods to do Class Simple Name Get
String | simpleClassName(String fqn) simple Class Name int lastDot = fqn.lastIndexOf('.'); return lastDot > 0 ? fqn.substring(lastDot + 1) : fqn; |
String | simpleClassNameAndHashCodeString(Object object) simple Class Name And Hash Code String if (object == null) { return "null_object"; return object.getClass().getSimpleName() + "@" + Integer.toHexString(object.hashCode()); |
String | simpleClassNameAndHashCodeString(Object object) simple Class Name And Hash Code String String simpleClassName = simpleClassName(object); if (object == null) { return simpleClassName; } else { return simpleClassName + "@" + Integer.toHexString(object.hashCode()); |
String | simpleClassNameFrom(String fqClassName) simple Class Name From if (fqClassName == null) { return null; } else if (fqClassName.isEmpty()) { return ""; final String[] split = fqClassName.split("\\."); return split[split.length - 1]; |
String | simpleClassNameOf(Class> c) Since Class.getSimpleName() method is not supported by GWT JRE. String cname = c.getName(); return cname.substring(cname.lastIndexOf('.') + 1); |
String | simpleName(Class clazz) simple Name String name = clazz.getName(); int p = name.lastIndexOf("."); if (p >= 0) { name = name.substring(p + 1); return name; |
String | simpleName(Class> c) Produce the simple name of the given class, as specified by Class#getSimpleName , with an improved scheme for anonymous classes. if (c.isArray()) { return simpleName(c.getComponentType()) + "[]"; } else if (isAnonymousClass(c)) { if (c.getInterfaces().length > 0) { return "anonymous " + simpleName(c.getInterfaces()[0]); } else { return "anonymous " + simpleName(c.getSuperclass()); } else { String fullName = c.getName(); int dot = fullName.lastIndexOf('.'); int dollar = fullName.lastIndexOf('$'); int nameStart = (dot > dollar) ? dot + 1 : dollar + 1; int length = fullName.length(); while (nameStart < length && Character.isDigit(fullName.charAt(nameStart))) { nameStart++; return fullName.substring(nameStart); |
String | simpleName(final Class> className) simple Name if (className != null) { return className.getSimpleName(); } else { return "NULL"; |
String | simpleName(final String fqn) simple Name int dotIndex = fqn.lastIndexOf("."); if (dotIndex == -1) { return fqn; if (dotIndex == fqn.length() - 1) { throw new IllegalArgumentException("Bad class name (trailing dot) [" + fqn + "]"); return fqn.substring(dotIndex + 1); ... |
String | simpleName(final String fullyQualifiedClassName) simple Name return fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf('.') + 1); |