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 TypeMethodDescriptionReturns the annotation type this validator targets.voidwrap(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
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 instancemethod- the method modelinstanceExpr- the expression of the target command instancesenderVar- the variable name of the resolved sendermethodSpec- the method spec builder to add wrapping code to
-