List of utility methods to do Class Name Clean
String | classNameFromQualifiedClassName(String qualifiedName) Return only class name of a full qualified (package+classname) string. if (qualifiedName == null) { throw new IllegalArgumentException("qualifiedName can't be null!"); int dot_index = qualifiedName.lastIndexOf('.'); if (dot_index != -1) return qualifiedName.substring(dot_index + 1); else return qualifiedName; ... |
String | classNameFromQualifiedName(String qualifiedCalssName) class Name From Qualified Name qualifiedCalssName = qualifiedCalssName.replace('.', ':'); String[] parts = qualifiedCalssName.split(":"); if (parts.length == 0) { return ""; return parts[parts.length - 1]; |
String | classNameOnly(Object o) Given an Object instance, returns just the classname with no package String s = "[null object ref]"; if (o != null) { s = classNameOnly(o.getClass().getName()); return s; |
String | classNameWithoutGeneric(String s) class Name Without Generic return removeGeneric(lastIdentifier(s));
|
String | classNameWithoutPackage(Class objectClass) Returns the name of a class with the package name cut off. return classNameWithoutPackage(objectClass.getName());
|
String | classNameWithoutPackage(Class> objectClass) class Name Without Package return classNameWithoutPackage(objectClass.getName());
|
String | classNameWithoutPackage(String classname) class Name Without Package String ret = classname; final int i = classname.lastIndexOf('.'); if (i != -1) { ret = classname.substring(i + 1); return ret; |
String | classNameWithoutPackageQualifiers(String className) class Name Without Package Qualifiers return className.substring(className.lastIndexOf(".") + 1); |