NextApp Echo3
v3.0.b4

nextapp.echo.app.reflect
Class IntrospectionUtil

java.lang.Object
  extended by nextapp.echo.app.reflect.IntrospectionUtil

public class IntrospectionUtil
extends java.lang.Object

Provides stateless utilities used for object introspection.


Constructor Summary
IntrospectionUtil()
           
 
Method Summary
static java.lang.String[] getTypeHierarchy(java.lang.String type, java.lang.ClassLoader classLoader)
          Returns a parent type hierarchy as an array containing the provided type and all of its parent types (excluding java.lang.Object).
static boolean isAssignableFrom(java.lang.String testType, java.lang.String baseType, java.lang.ClassLoader classLoader)
          Determines if the type specified by testType can be assigned to objects of the type specified by baseType.
static boolean isEventObject(java.lang.Class type)
          Determines if the provided Class is a java.util.EventObject.
static boolean isSuperType(java.lang.String testType, java.lang.String superType, java.lang.ClassLoader classLoader)
          Determines if superClass is a superclass of testClass.
static java.lang.String removePackageFromType(java.lang.String type)
          Removes the package name from a type name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntrospectionUtil

public IntrospectionUtil()
Method Detail

getTypeHierarchy

public static java.lang.String[] getTypeHierarchy(java.lang.String type,
                                                  java.lang.ClassLoader classLoader)
                                           throws java.lang.ClassNotFoundException
Returns a parent type hierarchy as an array containing the provided type and all of its parent types (excluding java.lang.Object). The highest-level types appear first, with the provided type at the first index.

Parameters:
type - the top-level type
classLoader - the ClassLoader through which introspection may be performed
Returns:
the type hierarchy
Throws:
java.lang.ClassNotFoundException

isAssignableFrom

public static boolean isAssignableFrom(java.lang.String testType,
                                       java.lang.String baseType,
                                       java.lang.ClassLoader classLoader)
                                throws java.lang.ClassNotFoundException
Determines if the type specified by testType can be assigned to objects of the type specified by baseType. This simply uses Class.isAssignableFrom after loading classes using the specified ClassLoader.

Parameters:
baseType - the base type
testType - the test type
classLoader - the ClassLoader to use to load the classes for testing
Throws:
java.lang.ClassNotFoundException

isEventObject

public static boolean isEventObject(java.lang.Class type)
Determines if the provided Class is a java.util.EventObject.

Parameters:
type - the Class to analyze
Returns:
true if type type extends java.util.EventObject

isSuperType

public static boolean isSuperType(java.lang.String testType,
                                  java.lang.String superType,
                                  java.lang.ClassLoader classLoader)
Determines if superClass is a superclass of testClass.

Parameters:
testType - the name class to test
superType - a class name which may/may not be a superclass of testClass
classLoader - a ClassLoader to use for the analysis.
Returns:
true if superClass is a superclass of testClass

removePackageFromType

public static java.lang.String removePackageFromType(java.lang.String type)
Removes the package name from a type name.

Parameters:
type - a fully qualified type name
Returns:
a relative version of the type name

NextApp Echo3
v3.0.b4