InterfaceClassFinder V1.0
by Matthew Ford
2009/01/06

au.com.forward.interfaceClassFinder
Class FindInterfaceClasses

java.lang.Object
  extended by au.com.forward.interfaceClassFinder.FindInterfaceClasses

public class FindInterfaceClasses
extends java.lang.Object

This class finds all classes that implement a given interface and returns the class names as a list.
Java libraries are not scanned. Only the classes and jars on the class path are scanned.


Field Summary
static java.lang.String newline
           
 
Constructor Summary
FindInterfaceClasses()
           
 
Method Summary
static java.util.List<java.lang.String> findClassNames(java.lang.Class interfaceClass)
          Scans the classpath and returns a list of fully qualified class names that implement the given interface class.
Only classes which implement the interface and have a no-arg public constructor are returned.
The interface can be implemented by a super class or the class can implement an interface that extends the given one.
static java.util.List<java.lang.String> getClassNames(java.lang.Class interfaceClass)
          Having called findClassNames() once you can then call this method with another interface class to find the classes that implement that interface.
static void main(java.lang.String[] args)
          Find the classes that implement the give fully qualified class and which have no-arg public constructors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newline

public static java.lang.String newline
Constructor Detail

FindInterfaceClasses

public FindInterfaceClasses()
Method Detail

findClassNames

public static java.util.List<java.lang.String> findClassNames(java.lang.Class interfaceClass)
Scans the classpath and returns a list of fully qualified class names that implement the given interface class.
Only classes which implement the interface and have a no-arg public constructor are returned.
The interface can be implemented by a super class or the class can implement an interface that extends the given one.

Parameters:
interfaceClass - the interface class to look for
Returns:
a list of fully qualified class names that implement the given interface and have a no-arg public constructor

getClassNames

public static java.util.List<java.lang.String> getClassNames(java.lang.Class interfaceClass)
Having called findClassNames() once you can then call this method with another interface class to find the classes that implement that interface.

Parameters:
interfaceClass - the interface the classes must implement.
Returns:
a list of fully qualified class names that implement the given interface and have a no-arg public constructor

main

public static void main(java.lang.String[] args)
Find the classes that implement the give fully qualified class and which have no-arg public constructors.

Parameters:
args - the full qualified interface class name, must exist in the class.

©2003-2009, Forward Computing and Control Pty. Ltd
ACN 003 669 994   NSW Australia
All Rights Reserved.