Skip to content

Instantly share code, notes, and snippets.

@AnnaBoro
Created February 13, 2016 16:08
Show Gist options
  • Save AnnaBoro/c41c2c19167adb570ceb to your computer and use it in GitHub Desktop.
Save AnnaBoro/c41c2c19167adb570ceb to your computer and use it in GitHub Desktop.
package lesson7_10.reflection;
import java.lang.annotation.Annotation;
public class ApplicationManager {
public void runManager(Class sclass) {
Annotation[] annotations = sclass.getAnnotations();
for (Annotation annotation : annotations) {
if (annotation.annotationType().getSimpleName().equalsIgnoreCase("service")) {
System.out.println("Class " + sclass.getSimpleName() + " has @Service");
}
else {
System.out.println("Class " + sclass.getSimpleName() + " doesn't have @Service");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment