1 Haziran 2018 Cuma

@Documented Anotasyonu

Giriş
Açıklaması şöyle.
Indicates that annotations with a type are to be documented by javadoc and similar tools by default. This type should be used to annotate the declarations of types whose annotations affect the use of annotated elements by their clients. If a type declaration is annotated with Documented, its annotations become part of the public API of the annotated elements.
Kendi anostasyonlarımızın javadoc ile üretilen html'de çıkmasını sağlar.

Örnek
Şöyle yaparız
import java.lang.annotation.Documented;

@Documented
public @interface MyAnnotation {
}
Örnek
Şöyle yaparız.
@Documented
@Retention(RUNTIME)
@Target({ANNOTATION_TYPE, TYPE})
@Constraint(validatedBy = SecondaryValidator.class)
public @interface ValidSecondary {
    String message() default "Invalid secondary";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
}

Hiç yorum yok:

Yorum Gönder