Via Java Reflection API, we can obtain all the annotations of a class as follows:
Class clazz = Foo.class; Annotation[] clazzAnnotations = clazz.getAnnotations();