Name
Inherited
Synopsis
When an annotation type that has an @Inherited
meta-annotation
is applied to a class, that annotation should be inherited by
subclasses and descendants of the annotated class. The inheritance is
only for classes and their subclasses. If an
@Inherited
annotation type is applied to a method
or program element other than a class, no inheritance applies. If the
@Inherited
annotation type also has runtime
Retention
, reflective access to the annotation
through java.lang.reflect.AnnotatedElement
manages
the inheritance of the annotation.
Figure 10-79. java.lang.annotation.Inherited
public @interface Inherited {
}
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.