net.sf.tlc.util
Class ClassUtils

java.lang.Object
  extended bynet.sf.tlc.util.ClassUtils

public final class ClassUtils
extends java.lang.Object

Provides a set of static utility methods for working with Classes

Author:
aisrael

Method Summary
static boolean doesExtend(java.lang.Class c, java.lang.Class parent)
          Return true if Class c is as subclass of parent
static boolean doesImplement(java.lang.Class c, java.lang.Class iface)
           
static java.lang.String getFriendlyClassName(java.lang.Class c)
           
static boolean isAbstractClass(java.lang.Class c)
          Return true if the given class is abstract
static boolean isRunnable(java.lang.Class c)
          Return true if the given class implements the Runnable interface
static java.util.List listAllInterfaces(java.lang.Class c)
          List all interfaces implemented by the given class
static java.util.List listAllSuperClasses(java.lang.Class c)
          Returns a List of all super classes of the given class
static java.lang.String[] listBeanProperties(java.lang.Class c)
          Return a 'friendly-name' list of public JavaBean 'properties' - that is, all accessor methods of the form getAbc() with the 'get' removed and the first letter of the 'property' converted to lower case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

listBeanProperties

public static java.lang.String[] listBeanProperties(java.lang.Class c)
Return a 'friendly-name' list of public JavaBean 'properties' - that is, all accessor methods of the form getAbc() with the 'get' removed and the first letter of the 'property' converted to lower case.

Parameters:
c - Class
Returns:
an array of friendly property names (String[])

listAllInterfaces

public static java.util.List listAllInterfaces(java.lang.Class c)
List all interfaces implemented by the given class

Parameters:
c - Class
Returns:
List of all interfaces (Class) implemented by the class

listAllSuperClasses

public static java.util.List listAllSuperClasses(java.lang.Class c)
Returns a List of all super classes of the given class

Parameters:
c - Class
Returns:
a List of all super classes of the given class

isRunnable

public static boolean isRunnable(java.lang.Class c)
Return true if the given class implements the Runnable interface

Parameters:
c - Class
Returns:
true if the give class implements the Runnable interface

isAbstractClass

public static boolean isAbstractClass(java.lang.Class c)
Return true if the given class is abstract

Parameters:
c - Class
Returns:
true if the given class is abstract

doesExtend

public static boolean doesExtend(java.lang.Class c,
                                 java.lang.Class parent)
Return true if Class c is as subclass of parent

Parameters:
c - Class under test
parent - parent Class
Returns:
true if Class c is as subclass of parent

doesImplement

public static boolean doesImplement(java.lang.Class c,
                                    java.lang.Class iface)
Parameters:
c - Class under test
iface - an interface
Returns:
true if Class c implements iface

getFriendlyClassName

public static java.lang.String getFriendlyClassName(java.lang.Class c)
Parameters:
c - Class
Returns:
friendly class name (e.g., "byte[]" or "java.lang.String")


Copyright © 2005 TheLittleContainer. All Rights Reserved.