public class IntrospectionUtil
extends java.lang.Object
| Constructor and Description |
|---|
IntrospectionUtil() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static java.lang.String[] getTypeHierarchy(java.lang.String type,
java.lang.ClassLoader classLoader)
throws java.lang.ClassNotFoundException
java.lang.Object). The highest-level types appear first,
with the provided type at the first index.type - the top-level typeclassLoader - the ClassLoader through which
introspection may be performedjava.lang.ClassNotFoundExceptionpublic static boolean isAssignableFrom(java.lang.String testType,
java.lang.String baseType,
java.lang.ClassLoader classLoader)
throws java.lang.ClassNotFoundException
testType can be assigned to objects of the type
specified by baseType.
This simply uses Class.isAssignableFrom after loading classes using the specified ClassLoader.baseType - the base typetestType - the test typeclassLoader - the ClassLoader to use to load the classes for testingjava.lang.ClassNotFoundExceptionpublic static boolean isEventObject(java.lang.Class type)
Class is a
java.util.EventObject.type - the Class to analyzetype type extends
java.util.EventObjectpublic static boolean isSuperType(java.lang.String testType,
java.lang.String superType,
java.lang.ClassLoader classLoader)
superClass is a superclass of
testClass.testType - the name class to testsuperType - a class name which may/may not be a superclass of
testClassclassLoader - a ClassLoader to use for the analysis.superClass is a superclass of
testClasspublic static java.lang.String removePackageFromType(java.lang.String type)
type - a fully qualified type name