Team LiB
Previous Section Next Section

Inheritedjava.lang.annotation

Java 5.0@Documented @Retention(RUNTIME) @Target(ANNOTATION_TYPE) annotation

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 {
}

    Team LiB
    Previous Section Next Section