Suppose I have an interface called Account.
public interface Account {
public int getAccountNumber();
}
Say I then create two implementations:
public class BankAccount implements Account {
public int getAccountNumber() { return 100; }
}
public class TelephoneAccount implements Account {
public int getAccountNumber() { return 200; }
}
... Now I want to create a class with a main method that when executed lists all implementations of the Account interface. It should also pick up any implementations that are stored within JAR files that are on the classpath etc.
So far I have tried using reflection and the apache commons discovery project, but have not been successful :-(
Any anyone help? :-)
2006-07-11
22:49:55
·
3 answers
·
asked by
Tim C
1
in
Computers & Internet
➔ Programming & Design