lundi 13 mars 2017

How can I retrieve all classes that implement a custom interface?

I want to get all classes that implement the IFeature Interface. Java Refelctions appear to be a possible solution, but it doesn't work the way I want it to.

IFeature feature = new Landing();
Class<?>[] cls = Character.class.getInterfaces();
for(Class<?> c : cls ){
    System.out.println(c.toString());
}

the output

run:

interface java.io.Serializable

interface java.lang.Comparable

BUILD SUCCESSFUL (total time: 0 seconds)

my interface...

public interface IFeature {
    public abstract void update(HashMap<QueueIdentifier, Queue<Measurement>> messageMap);
    public abstract List<QueueIdentifier> getQIdList();
    public abstract int getCountSamples();
}





Aucun commentaire:

Enregistrer un commentaire