vendredi 26 mai 2017

Java - How to import 'Reflections' class?

Im trying to use reflections classes as suggested here http://ift.tt/2rp1FFF

Reflections reflections = new Reflections("my.project.prefix");
Set<Class<? extends SomeType>> subTypes = 
        reflections.getSubTypesOf(SomeType.class);
Set<SomeType> someTypes = new HashSet<SomeType>(subTypes.size());
for (Class<? extends SubType> subType : subTypes) {
    someTypes.add(subType.newInstance());
}

However, I cant seem to import the necessary package. NetBeans cant find it, and also I tried importing java.lang.reflections but it doesn't do it. I can see java.lang.Class, but I don't see Reflections class anywhere.

Can anyone please show me the way to the light?

t





Aucun commentaire:

Enregistrer un commentaire