bpiwowar.argparser.utils
Class Introspection

java.lang.Object
  extended by bpiwowar.argparser.utils.Introspection

public class Introspection
extends Object

Methods used for introspection

Author:
B. Piwowarski

Nested Class Summary
static interface Introspection.Checker
          A checker class
 
Field Summary
static org.apache.log4j.Logger logger
           
 
Constructor Summary
Introspection()
           
 
Method Summary
static void addClasses(Introspection.Checker checker, ArrayList<Class<?>> list, int levels, JarURLConnection conn, String prefix)
           
static void addClasses(Introspection.Checker checker, ArrayList<Class<?>> list, String packageName, int levels)
          Add classes to the list
static void addClasses(Introspection.Checker checker, ArrayList<Class<?>> list, String packageName, int levels, File directory)
           
static void addClasses(Introspection.Checker checker, ArrayList<Class<?>> list, String packageName, int levels, URL url)
           
static void addImplementors(ArrayList<Class<?>> list, Class<?> which, String packageName, int levels)
           
static ArrayList<Class<?>> getClasses(Introspection.Checker checker, String packageName, int levels)
           
static Class<?>[] getImplementors(Class<?> which, String packageName, int levels)
          Get the list of class which implement a given class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.apache.log4j.Logger logger
Constructor Detail

Introspection

public Introspection()
Method Detail

getImplementors

public static Class<?>[] getImplementors(Class<?> which,
                                         String packageName,
                                         int levels)
Get the list of class which implement a given class

Parameters:
which - The base class
packageName - the package where classes are searched
levels - number of levels to be explored (-1 for infinity)
Returns:
an array of objects of the given class

addImplementors

public static void addImplementors(ArrayList<Class<?>> list,
                                   Class<?> which,
                                   String packageName,
                                   int levels)

getClasses

public static ArrayList<Class<?>> getClasses(Introspection.Checker checker,
                                             String packageName,
                                             int levels)

addClasses

public static void addClasses(Introspection.Checker checker,
                              ArrayList<Class<?>> list,
                              String packageName,
                              int levels)
Add classes to the list

Parameters:
checker - Used to filter the classes
list - The list to fill
packageName - The package to be analyzed
levels - The maximum number of recursion within the structure (or -1 if infinite)

addClasses

public static void addClasses(Introspection.Checker checker,
                              ArrayList<Class<?>> list,
                              String packageName,
                              int levels,
                              URL url)
Parameters:
checker -
list -
packageName -
levels -
url -

addClasses

public static void addClasses(Introspection.Checker checker,
                              ArrayList<Class<?>> list,
                              int levels,
                              JarURLConnection conn,
                              String prefix)
                       throws IOException
Parameters:
checker -
list -
levels -
conn -
prefix -
Throws:
IOException

addClasses

public static void addClasses(Introspection.Checker checker,
                              ArrayList<Class<?>> list,
                              String packageName,
                              int levels,
                              File directory)
Parameters:
checker -
list -
packageName -
levels -
directory -


Copyright © 2013. All Rights Reserved.