<dependency>
<groupId>org.n52.annotation</groupId>
<artifactId>faroe-annotations</artifactId>
<version>1.0.0</version>
</dependency>
import org.n52.faroe.annotation.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Name("CustomAnnotation")
public @interface MyAnnotation {
@Parameter(required = true)
String value();
}
public class MyClass {
@MyAnnotation("Hello World")
public void myMethod() {
}
}
import org.n52.faroe.annotation.processor.AbstractSingleAnnotationProcessor;
import org.n52.faroe.annotation.processor.ProcessingResult;
import java.lang.reflect.Method;
public class MyAnnotationProcessor extends AbstractSingleAnnotationProcessor<MyAnnotation> {
@Override
protected ProcessingResult processAnnotation(MyAnnotation annotation, Method method) {
String value = annotation.value();
System.out.println("Annotation value: " + value);
return ProcessingResult.SUCCESS;
}
}