Last active
September 19, 2015 14:59
-
-
Save ricdex/8c7cda76292c184394cf to your computer and use it in GitHub Desktop.
encontrar clases por anotaciones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Retention(RetentionPolicy.RUNTIME) | |
@Target(ElementType.TYPE) | |
public @interface Execute { | |
String target() default ""; | |
} | |
//---------------- | |
Reflections reflections = new Reflections("path.donde.estan.las.clases.con.esa.anotacion"); | |
Set<Class<?>> annotated = reflections.getTypesAnnotatedWith(Execute.class); | |
//-------------------- | |
for (Class<?> taskClass : annotated) { | |
Execute task = taskClass.getAnnotation(Execute.class); | |
String target = task.target(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment