Interface ParserFactory


@AvailableSince("0.0.30") public interface ParserFactory
A factory associated with specific annotations to create argument parsers based on annotations present in the command class
See Also:
  • Method Details

    • findClassParsers

      @AvailableSince("0.0.37") static Map<String,ArgumentParser<?>> findClassParsers(GenericNode node, Class<?> clazz, Map<Class<? extends ParserFactory>,ParserFactory> parserFactories)
      Get argument parsers from a class
      Parameters:
      node - command node
      clazz - target class
      parserFactories - parser factories for caching
      Returns:
      argument parsers
    • getArgumentParsers

      @AvailableSince("0.0.37") static Map<String,ArgumentParser<?>> getArgumentParsers(GenericNode node, Annotation[] annotations, GenericDeclaration obj, boolean limitToClassParsers, Map<Class<? extends ParserFactory>,ParserFactory> parserFactories)
      Get argument parsers from an array of annotations
      Parameters:
      node - command node
      annotations - annotations
      obj - the class / method
      limitToClassParsers - limit to class parsers only
      parserFactories - parser factories for caching
      Returns:
      argument parsers
    • getArgumentParsers

      @AvailableSince("0.0.37") static Map<String,ArgumentParser<?>> getArgumentParsers(GenericNode node, Annotation annotation, GenericDeclaration obj, boolean limitToClassParsers, Map<Class<? extends ParserFactory>,ParserFactory> parserFactories)
      Get argument parsers from an annotation
      Parameters:
      node - command node
      annotation - annotation
      obj - the class / method
      limitToClassParsers - limit to class parsers only
      parserFactories - parser factories for caching
      Returns:
      argument parsers
    • getParserFactoryClass

      @AvailableSince("0.0.37") static Class<? extends ParserFactory> getParserFactoryClass(Annotation annotation)
      Get the class of the parser factory from an annotation
      Parameters:
      annotation - The annotation that has a CommandParserFactory
      Returns:
      The class of the parser factory
    • createFromAnnotation

      @AvailableSince("0.0.37") static ParserFactory createFromAnnotation(Annotation annotation, boolean onlyClassParser)
      Create a parser factory from an annotation
      Parameters:
      annotation - The annotation that has a CommandParserFactory
      onlyClassParser - Whether to only create parsers for classes
      Returns:
      The created parser factory
    • getArgumentParser

      @NotNull @NotNull Collection<ParserFactory.ParserResult> getArgumentParser(GenericNode node, Annotation annotation, GenericDeclaration obj)
      Construct argument parsers for the given annotation
      Parameters:
      node - The node of the command / compound parser
      annotation - The annotation to construct the argument parser for
      obj - The annotated element, either a method or a class
      Returns:
      A collection of argument parsers to be registered to the scope