Java Utililty Methods Class Name Extract

List of utility methods to do Class Name Extract

Description

The list of methods to do Class Name Extract are organized into topic(s).

Method

StringextractClassNameWithoutPackage(String className)
Removes the package section from a fully qualified class name.
int dotPos = className.lastIndexOf(".");
if (dotPos != -1) {
    className = className.substring(dotPos + 1);
int dollarPos = className.lastIndexOf("$");
if (dollarPos != -1) {
    className = className.substring(dollarPos + 1);
return className;
StringextractClassNameWithParent(String fullClassName)
Class name with the parent if one exists.
String[] splitName = fullClassName.split("\\.");
return splitName[Math.max(splitName.length - 1, 0)];