Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.lang
Class ClassHelper  view ClassHelper download ClassHelper.java

java.lang.Object
  extended bygnu.java.lang.ClassHelper

public class ClassHelper
extends java.lang.Object

ClassHelper has various methods that ought to have been in Class.


Field Summary
private static java.util.Map allFields
          Cache of fields found in getAllFields().
private static java.util.Map allMethods
          Cache of methods found in getAllMethods().
 
Constructor Summary
ClassHelper()
           
 
Method Summary
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.
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.
static java.lang.String getTruncatedClassName(java.lang.Class clazz)
          Strip the package part from the class name.
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.
static java.lang.String getUserName(java.lang.Class klass)
          Return the name of the class as written by the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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().

Constructor Detail

ClassHelper

public ClassHelper()
Method Detail

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.