Class ValidateWithHandler
java.lang.Object
io.github.projectunified.craftcommand.validation.processor.extension.ValidateWithHandler
- All Implemented Interfaces:
ParameterAnnotationHandler<ValidateWith>
Built-in validation handler for
@ValidateWith annotations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the annotation type this handler targets.voidhandle(ValidateWith 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.
-
Constructor Details
-
ValidateWithHandler
public ValidateWithHandler()
-
-
Method Details
-
annotationType
Description copied from interface:ParameterAnnotationHandlerGets the annotation type this handler targets.- Specified by:
annotationTypein interfaceParameterAnnotationHandler<ValidateWith>- Returns:
- the annotation class
-
handle
public void handle(ValidateWith annotation, ParameterModel parameter, String varName, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec) Description copied from interface:ParameterAnnotationHandlerInjects 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.- Specified by:
handlein interfaceParameterAnnotationHandler<ValidateWith>- Parameters:
annotation- the parameter annotation instanceparameter- the parameter modelvarName- 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
-