Java Utililty Methods Class Simple Name Get

List of utility methods to do Class Simple Name Get

Description

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

Method

StringsimpleName(final String name)
Return a lower case, non-spaced version of the specified name.
final int len = name.length();
final StringBuffer sb = new StringBuffer(len);
for (int pos = 0; pos < len; pos++) {
    final char ch = name.charAt(pos);
    if (ch == ' ') {
        continue;
    sb.append(Character.toLowerCase(ch));
...
StringsimpleName(Object obj)
simple Name
return getClass(obj).getSimpleName();
StringsimpleName(String className)
simple Name
String[] parts = className.split("\\.");
if (parts.length == 0) {
    return null;
return parts[parts.length - 1];
StringsimpleName(String componentName)
Extracts the component simple name from the fully qualified component name.
int p = componentName.lastIndexOf('/');
if (p >= 0) {
    return componentName.substring(p + 1);
return null;
StringsimpleName(String qualifiedClassName)
simple Name
String packageName = packageName(qualifiedClassName);
return packageName.isEmpty() ? qualifiedClassName : qualifiedClassName.substring(packageName.length() + 1);
StringsimpleName(String qualifiedName)
simple Name
return qualifiedName.substring(
        qualifiedName.lastIndexOf('.') != -1 ? qualifiedName.lastIndexOf('.') + 1 : 0,
        qualifiedName.length());
StringsimpleName(String type)
simple Name
int ix = type.lastIndexOf('.');
if (ix == -1) {
    return type;
return type.substring(ix + 1);
StringsimpleNameFromQualifiedName(String qualifiedName)
simple Name From Qualified Name
int lastPeriodIndex = qualifiedName.lastIndexOf('.');
if (lastPeriodIndex == -1)
    return qualifiedName;
else
    return qualifiedName.substring(lastPeriodIndex + 1);
StringsimpleNameOf(String s)
Returns the simple class name once package is strip package.
if (s.contains(".")) {
    return s.substring(s.lastIndexOf('.') + 1);
} else {
    return s;
StringsimpleNameWithoutEnhance(Class clazz)
simple Name Without Enhance
String simpleName = clazz.getSimpleName();
if (simpleName.contains("$$Enhancer")) {
    simpleName = simpleName.substring(0, simpleName.indexOf("$$Enhancer"));
return simpleName;