Class ActionAnnotationProcessor

java.lang.Object
javax.annotation.processing.AbstractProcessor
com.scivicslab.pojoactor.core.ActionAnnotationProcessor
All Implemented Interfaces:
Processor

@SupportedAnnotationTypes("*") @SupportedSourceVersion(RELEASE_21) public class ActionAnnotationProcessor extends AbstractProcessor
Compile-time annotation processor for @Action annotation and IIActorRef patterns.

This processor performs two validations:

  1. @Action on non-IIActorRef: Emits ERROR when @Action is used on a class that doesn't extend IIActorRef.
  2. callByActionName override: Emits WARNING when an IIActorRef subclass overrides callByActionName instead of using @Action.

Why These Validations?

The @Action annotation mechanism relies on IIActorRef's callByActionName() implementation to discover and invoke annotated methods via reflection. If @Action is placed on a POJO that doesn't extend IIActorRef, the annotation will be silently ignored at runtime.

Overriding callByActionName with switch statements is a deprecated pattern. Using @Action annotation is cleaner and more maintainable.

Correct Usage


 public class MyActor extends IIActorRef<Void> {
     public MyActor(String name, IIActorSystem system) {
         super(name, null, system);
     }

     @Action("doSomething")
     public ActionResult doSomething(String args) {
         return new ActionResult(true, "done");
     }
 }
 
Since:
2.15.0
Author:
devteam@scivicslab.com