java.lang.Object
io.github.projectunified.craftcommand.validation.processor.extension.MaxHandler
All Implemented Interfaces:
ParameterAnnotationHandler<Max>

public class MaxHandler extends Object implements ParameterAnnotationHandler<Max>
Built-in validation handler for @Max annotations.
  • Constructor Details

    • MaxHandler

      public MaxHandler()
  • Method Details

    • annotationType

      public Class<Max> annotationType()
      Description copied from interface: ParameterAnnotationHandler
      Gets the annotation type this handler targets.
      Specified by:
      annotationType in interface ParameterAnnotationHandler<Max>
      Returns:
      the annotation class
    • handle

      public void handle(Max annotation, ParameterModel parameter, String varName, String instanceExpr, String senderVar, com.palantir.javapoet.MethodSpec.Builder methodSpec)
      Description copied from interface: ParameterAnnotationHandler
      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.
      Specified by:
      handle in interface ParameterAnnotationHandler<Max>
      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