Interface MethodAnnotationHandler<A extends Annotation>
- Type Parameters:
A- the type of annotation
public interface MethodAnnotationHandler<A extends Annotation>
SPI handler to inject custom validation or execution logic based on method-level annotations.
-
Method Summary
Modifier and TypeMethodDescriptionGets the annotation type this handler targets.voidhandle(A annotation, MethodModel method, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec) Injects custom code (e.g. permission/cooldown checks) into the generated method execution code block.
-
Method Details
-
annotationType
Gets the annotation type this handler targets.- Returns:
- the annotation class
-
handle
void handle(A annotation, MethodModel method, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec) Injects custom code (e.g. permission/cooldown checks) into the generated method execution code block. Called before parameter resolution and method invocation.- Parameters:
annotation- the method annotation instancemethod- the method modelinstanceExpr- 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
-