java.lang.Object
gnu.java.lang.ClassHelper
- public class ClassHelper
- extends java.lang.Object
ClassHelper has various methods that ought to have been in Class.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
allMethods
private static java.util.Map allMethods
- Cache of methods found in getAllMethods().
allFields
private static java.util.Map allFields
- Cache of fields found in getAllFields().
ClassHelper
public ClassHelper()
getTruncatedClassName
public static java.lang.String getTruncatedClassName(java.lang.Class clazz)
- Strip the package part from the class name.
getTruncatedName
public static java.lang.String getTruncatedName(java.lang.String name)
- Strip the package part from the class name, or the class part from
the method or field name.
getUserName
public static java.lang.String getUserName(java.lang.Class klass)
- Return the name of the class as written by the user.
This is used by the various reflection toString methods.
It differs from Class.getName()>
Class.getName() 55 in that it prints
arrays with trailing "[]"s. Note that it does not treat
member classes specially, so a dollar sign may still appear
in the result. This is intentional.
getAllMethods
public static java.lang.reflect.Method[] getAllMethods(java.lang.Class clazz)
- Get all the methods, public, private and otherwise, from the class,
getting them from the most recent class to find them. This may not
be quite the correct approach, as this includes methods that are not
inherited or accessible from clazz, so beware.
getAllFields
public static java.lang.reflect.Field[] getAllFields(java.lang.Class clazz)
- Get all the fields, public, private and otherwise, from the class,
getting them from the most recent class to find them. This may not
be quite the correct approach, as this includes fields that are not
inherited or accessible from clazz, so beware.