September 2019
Intermediate to advanced
816 pages
18h 47m
English
For inspecting the annotations of the superclass, we need to call the getAnnotatedSuperclass() method:

This method returns the superclass type that is annotated:
Class<Melon> clazz = Melon.class;AnnotatedType superclassType = clazz.getAnnotatedSuperclass();
And let's get some information as well:
// modern.challenge.Cucurbitaceae System.out.println("Superclass type: " + superclassType.getType().getTypeName()); // [@modern.challenge.Family()] System.out.println("Annotations: " + Arrays.toString(superclassType.getDeclaredAnnotations())); System.out.println("@Family annotation present: " + superclassType.isAnnotationPresent(Family.class)); ...