Interface ParameterAnnotationHandler<A extends Annotation>

Type Parameters:
A - the type of annotation
All Known Implementing Classes:
MaxHandler, MinHandler, ValidateWithHandler

public interface ParameterAnnotationHandler<A extends Annotation>
SPI handler to inject custom validation or execution logic based on parameter-level annotations.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the annotation type this handler targets.
    void
    handle(A annotation, ParameterModel parameter, String varName, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec)
    Injects custom code (e.g. validation) into the generated method execution code block.
  • Method Details

    • annotationType

      Class<A> annotationType()
      Gets the annotation type this handler targets.
      Returns:
      the annotation class
    • handle

      void handle(A annotation, ParameterModel parameter, String varName, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec)
      Injects custom code (e.g. validation) into the generated method execution code block. Called after the parameter value is resolved and assigned to the parameter variable.
      Parameters:
      annotation - the parameter annotation instance
      parameter - the parameter model
      varName - the name of the generated parameter variable (e.g. "param_1")
      instanceExpr - the expression of the target command instance (e.g. "instance" or "this.subInstance_xxx")
      senderVar - the variable name representing the command sender (e.g. "senderCast")
      methodSpec - the method spec builder for the execute/onCommand method