Interface CommandValidator<A extends Annotation>

Type Parameters:
A - the annotation type

public interface CommandValidator<A extends Annotation>
SPI handler for method-level validation and execution wrapping annotations.

Unlike MethodAnnotationHandler which injects code before parameter resolution, CommandValidator can wrap the entire execution block (for cooldowns, async, etc.).

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the annotation type this validator targets.
    void
    wrap(A annotation, MethodModel method, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec)
    Wraps the execution of the command method with validation or async logic.
  • Method Details

    • annotationType

      Class<A> annotationType()
      Returns the annotation type this validator targets.
      Returns:
      the annotation class
    • wrap

      void wrap(A annotation, MethodModel method, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec)
      Wraps the execution of the command method with validation or async logic. Called after all parameters are resolved and before the method invocation.
      Parameters:
      annotation - the annotation instance
      method - the method model
      instanceExpr - the expression of the target command instance
      senderVar - the variable name of the resolved sender
      methodSpec - the method spec builder to add wrapping code to