public final class ClassUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getUnqualifiedName(Class<?> clazz)
Alternative to
Class.getSimpleName() that does not probe an enclosing class or method,
which can fail when they cannot be loaded. |
static boolean |
isSameOrParentLoader(ClassLoader parent,
ClassLoader child) |
public static String getUnqualifiedName(Class<?> clazz)
Class.getSimpleName() that does not probe an enclosing class or method,
which can fail when they cannot be loaded.
Note the differences to Class.getName() and Class.getSimpleName() (which might
actually be preferable):
Class.getName() Class.getSimpleName() ClassUtil.getUnqualifiedName() --------------------------------------------------------------------------------------------------- int int int java.lang.String String String [Ljava.lang.String; String[] String[] java.util.HashMap$EntrySet EntrySet HashMap$EntrySet com.example.ClassWithAnonymousInnerClass$1 "" ClassWithAnonymousInnerClass$1
public static boolean isSameOrParentLoader(ClassLoader parent, ClassLoader child)