Class RequestAnnotationProcessor

java.lang.Object
javax.annotation.processing.AbstractProcessor
io.fluxcapacitor.javaclient.tracking.handling.RequestAnnotationProcessor
All Implemented Interfaces:
Processor

@SupportedAnnotationTypes({"io.fluxcapacitor.javaclient.tracking.handling.HandleQuery","io.fluxcapacitor.javaclient.tracking.handling.HandleCommand","io.fluxcapacitor.javaclient.tracking.handling.HandleCustom"}) @AutoService(javax.annotation.processing.Processor.class) public class RequestAnnotationProcessor extends AbstractProcessor
Annotation processor that validates whether handler methods annotated with HandleCommand, HandleQuery or HandleCustom correctly match the response type declared by a Request payload.

The processor enforces compile-time consistency between:

  • The generic type R in Request<R>
  • The actual return type of the handler method (or Future<R>)

Validation Rules

  • If a handler method accepts a Request<R> as a parameter, its return type must match R
  • Asynchronous handlers that return Future<R> are also supported
  • Handlers marked as passive=true are skipped
  • Errors are reported at compile time with descriptive messages

Example


 @HandleQuery
 UserProfile handle(GetUser query) {
     return FluxCapacitor.search(UserProfile.class).match(query.getUserId()).fetchFirstOrNull();
 }
 

If the method were to return e.g. String instead of UserProfile, a compile-time error would be raised.

Supported Annotations

This processor is automatically registered via @AutoService(Processor.class) and does not require manual configuration.