nl.knowledgeplaza.util
Class ClassUtil

java.lang.Object
  extended by nl.knowledgeplaza.util.ClassUtil

public class ClassUtil
extends Object

Version:
$Revision: 1.5 $

Field Summary
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
ClassUtil()
           
 
Method Summary
static Class convertPrimitiveToObject(Class c)
          Converts the primitive type to its corresponding Object type.
static URL determineWhereClassIsLoadedFrom(Class cls)
           
static boolean exists(String name)
          Check if a class exists without executing the static constructor
static Class forName(String name)
          Identical to Class.forName but wraps the ClassNotFoundException in a runtime exception
static String getSimpleName(Class c)
           
static boolean objectIsKindOfClass(Object pObject, Class pClass)
          Return true if class of object, or any superclass thereof, is the same as the class argument.
static boolean objectIsMemberOfClass(Object pObject, Class pClass)
          Returns true if the object passed in is an instance of the class passed in.
static boolean objectIsSubclassOfClass(Object pObject, Class pClass)
          Returns true if the object passed in is a subclass of the class passed in.
static Class primitiveNameToClass(String s)
          Converts the primitive class name to its corresponding class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

ClassUtil

public ClassUtil()
Method Detail

objectIsSubclassOfClass

public static boolean objectIsSubclassOfClass(Object pObject,
                                              Class pClass)
Returns true if the object passed in is a subclass of the class passed in. Returns false if the object is exactly the same class as the object passed in, or if the object is part of a different class hierarchy.


objectIsMemberOfClass

public static boolean objectIsMemberOfClass(Object pObject,
                                            Class pClass)
Returns true if the object passed in is an instance of the class passed in. The object must EXACTLY be the same class as the class passed in.


objectIsKindOfClass

public static boolean objectIsKindOfClass(Object pObject,
                                          Class pClass)
Return true if class of object, or any superclass thereof, is the same as the class argument.


exists

public static boolean exists(String name)
Check if a class exists without executing the static constructor

Parameters:
name -
Returns:

convertPrimitiveToObject

public static Class convertPrimitiveToObject(Class c)
Converts the primitive type to its corresponding Object type.

Example: passing a int will return Integer.

Parameters:
c - the primitive type
Returns:
the Object type

primitiveNameToClass

public static Class primitiveNameToClass(String s)
Converts the primitive class name to its corresponding class.

Example: passing a "int" will return int.class.

Parameters:
c - the primitive class name
Returns:
the class

getSimpleName

public static String getSimpleName(Class c)

forName

public static Class forName(String name)
Identical to Class.forName but wraps the ClassNotFoundException in a runtime exception

Parameters:
name -
Returns:

determineWhereClassIsLoadedFrom

public static URL determineWhereClassIsLoadedFrom(Class cls)
Parameters:
cls -
Returns:


Copyright © 2012 KnowledgePlaza. All Rights Reserved.