Returns the name of a class without the package name
public class Utils {
/**
* Returns the name of a class without the package name. For example: if
* input = "java.lang.Object" , then output = "Object".
* @param fully qualified classname
* @return the unqualified classname
*/
public static String getShortClassName(final String className) {
if (className != null) {
final int index = className.lastIndexOf('.');
return className.substring(index + 1);
}
return null;
}
}
Related examples in the same category