|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.utils.SubclassFinder
public class SubclassFinder
Utility-class with static methods to
InstanceParameterSet that can be used to
instantiate a sub-class of InstantiableFromParameterSet.CollectionParameter using all possible
InstanceParameterSets (for classes that are a subclass of a specified
superclass) as elementsClassLoader than the caller
| Constructor Summary | |
|---|---|
SubclassFinder()
|
|
| Method Summary | ||
|---|---|---|
static
|
filterBySuperclass(Class<S> superclass,
LinkedList<Class<? extends T>> listToFilter)
Returns a LinkedList of the Class objects for all classes
in listToFilter that are sub-classes of
superClass. |
|
static
|
findInstantiableSubclasses(Class<T> clazz,
String startPackage)
Returns all sub-classes of T that can be instantiated, i.e. |
|
static
|
findSubclasses(Class<T> clazz,
String startPackage)
Returns all sub-classes of T including interfaces and
abstract classes that are located in a package below
startPackage. |
|
static
|
getCollection(Class<T> clazz,
String startPackage,
String name,
String comment,
boolean required)
This method creates an CollectionParameter that contains
InstanceParameterSet for each possible
class. |
|
static
|
getInstanceParameterSets(Class<T> clazz,
String startPackage)
This method returns a list of InstanceParameterSets that can be used to create a subclass of clazz. |
|
static LinkedList<Class<? extends InstanceParameterSet>> |
getParameterSetFor(Class<? extends InstantiableFromParameterSet> clazz)
Returns a LinkedList of the classes of the
InstanceParameterSets that can be used to instantiate the
sub-class of InstantiableFromParameterSet that is given by
clazz |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SubclassFinder()
| Method Detail |
|---|
public static <T> LinkedList<Class<? extends T>> findInstantiableSubclasses(Class<T> clazz,
String startPackage)
throws ClassNotFoundException,
IOException
T that can be instantiated, i.e.
are neither an interface nor abstract, and that are located in a package
below startPackage.
T - The class to obtain the sub-classes forclazz - the Class object for TstartPackage - the package under which to search
Class objects for the sub-classes
ClassNotFoundException - if one of the classes is present in the file system or jar
but cannot be loaded by the class loader
IOException - is thrown if the classes are searched for in a jar file, but
that file could not be accessed or read
public static <S,T> LinkedList<Class<? extends S>> filterBySuperclass(Class<S> superclass,
LinkedList<Class<? extends T>> listToFilter)
LinkedList of the Class objects for all classes
in listToFilter that are sub-classes of
superClass.
S - the class that is used as filterT - a common super-class of all classes in
listToFiltersuperclass - the additional class to use as a filter criterionlistToFilter - the list of classes
public static LinkedList<Class<? extends InstanceParameterSet>> getParameterSetFor(Class<? extends InstantiableFromParameterSet> clazz)
LinkedList of the classes of the
InstanceParameterSets that can be used to instantiate the
sub-class of InstantiableFromParameterSet that is given by
clazz
clazz - the Class object of the sub-class of
InstantiableFromParameterSet
LinkedList of Classes of the corresponding
InstanceParameterSets
public static <T> LinkedList<Class<? extends T>> findSubclasses(Class<T> clazz,
String startPackage)
throws ClassNotFoundException,
IOException
T including interfaces and
abstract classes that are located in a package below
startPackage.
T - The class to obtain the sub-classes forclazz - the Class object for TstartPackage - the package under which to search
Class objects for the sub-classes
ClassNotFoundException - if one of the classes is present in the file system or jar
but cannot be loaded by the class loader
IOException - is thrown if the classes are searched for in a jar file, but
that file could not be accessed or read
public static <T> CollectionParameter getCollection(Class<T> clazz,
String startPackage,
String name,
String comment,
boolean required)
throws InstantiationException,
IllegalAccessException,
ClassNotFoundException,
IOException
CollectionParameter that contains
InstanceParameterSet for each possible
class. The classes are specified by
findInstantiableSubclasses(Class, String) and
filterBySuperclass(Class, LinkedList).
T - The class to use the sub-classes in the
CollectionParameterclazz - the Class object for TstartPackage - the package under which to start the searchname - the name of the CollectionParametercomment - the comment for the CollectionParameterrequired - whether the CollectionParameter is required
CollectionParameter that contains
InstanceParameterSet for each
possible class.
InstantiationException - if any InstanceParameterSet has no nullary
constructor; or if the instantiation fails for some other
reason
IllegalAccessException - if any InstanceParameterSet or its nullary
constructor is not accessible
ClassNotFoundException - if one of the classes is present in the file system or jar
but cannot be loaded by the class loader
IOException - if the classes are searched for in a jar file, but that file
could not be accessed or readfindInstantiableSubclasses(Class, String),
filterBySuperclass(Class, LinkedList),
getInstanceParameterSets(Class, String)
public static <T> LinkedList<InstanceParameterSet> getInstanceParameterSets(Class<T> clazz,
String startPackage)
throws ClassNotFoundException,
IOException,
InstantiationException,
IllegalAccessException
InstanceParameterSets that can be used to create a subclass of clazz.
The classes are specified by
findInstantiableSubclasses(Class, String) and
filterBySuperclass(Class, LinkedList).
T - The class to use the sub-classes in the
CollectionParameterclazz - the Class object for TstartPackage - the package under which to start the search
LinkedList that contains
InstanceParameterSet for each
possible class.
InstantiationException - if any InstanceParameterSet has no nullary
constructor; or if the instantiation fails for some other
reason
IllegalAccessException - if any InstanceParameterSet or its nullary
constructor is not accessible
ClassNotFoundException - if one of the classes is present in the file system or jar
but cannot be loaded by the class loader
IOException - if the classes are searched for in a jar file, but that file
could not be accessed or readfindInstantiableSubclasses(Class, String),
filterBySuperclass(Class, LinkedList)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||