nl.knowledgeplaza.util
Class ClassUtil

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

public class ClassUtil
extends java.lang.Object

Version:
$Revision: 1.3 $

Field Summary
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
ClassUtil()
           
 
Method Summary
static java.lang.Class convertPrimitiveToObject(java.lang.Class c)
          Converts the primitive type to its corresponding Object type.
static java.lang.Class forName(java.lang.String name)
          Identical to Class.forName but wraps the ClassNotFoundException in a runtime exception
static java.lang.String getSimpleName(java.lang.Class c)
           
static boolean objectIsKindOfClass(java.lang.Object pObject, java.lang.Class pClass)
          Return true if class of object, or any superclass thereof, is the same as the class argument.
static boolean objectIsMemberOfClass(java.lang.Object pObject, java.lang.Class pClass)
          Returns true if the object passed in is an instance of the class passed in.
static boolean objectIsSubclassOfClass(java.lang.Object pObject, java.lang.Class pClass)
          Returns true if the object passed in is a subclass of the class passed in.
static java.lang.Class primitiveNameToClass(java.lang.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 java.lang.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(java.lang.Object pObject,
                                              java.lang.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(java.lang.Object pObject,
                                            java.lang.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(java.lang.Object pObject,
                                          java.lang.Class pClass)
Return true if class of object, or any superclass thereof, is the same as the class argument.


convertPrimitiveToObject

public static java.lang.Class convertPrimitiveToObject(java.lang.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 java.lang.Class primitiveNameToClass(java.lang.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 java.lang.String getSimpleName(java.lang.Class c)

forName

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

Parameters:
name -
Returns:


Copyright © 2010. All Rights Reserved.