Java / Annotations
How do I create a custom Java Annotation?
Java Annotation definition resembles an interface definition where the keyword interface is preceded by @. @ represents Annotation type (AT).
The Java Annotation body contains annotation type element declarations that look like method and also can define an optional default value.
package net.javapedia.annotations; public @interface CustomAnnotation { int value(); }
package net.javapedia.annotations; @CustomAnnotation public class AnnotatedClass { }
More Related questions...