Class CommandMethods


  • public class CommandMethods
    extends java.lang.Object
    Class that encapsulates the execution and completion methods for a command.

    CommandMethods provides a way to associate a command execution function with a completer compilation function. This allows commands to be registered with both their execution logic and their completion logic in a single object.

    • Constructor Summary

      Constructors 
      Constructor Description
      CommandMethods​(java.util.function.Consumer<CommandInput> execute, java.util.function.Function<java.lang.String,​java.util.List<org.jline.reader.Completer>> compileCompleter)
      Creates a new CommandMethods with the specified execution and completer compilation functions.
      CommandMethods​(java.util.function.Function<CommandInput,​?> execute, java.util.function.Function<java.lang.String,​java.util.List<org.jline.reader.Completer>> compileCompleter)
      Creates a new CommandMethods with the specified execution and completer compilation functions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.function.Function<java.lang.String,​java.util.List<org.jline.reader.Completer>> compileCompleter()
      Returns the function that compiles completers for the command.
      java.util.function.Function<CommandInput,​?> execute()
      Returns the function that executes the command.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandMethods

        public CommandMethods​(java.util.function.Function<CommandInput,​?> execute,
                              java.util.function.Function<java.lang.String,​java.util.List<org.jline.reader.Completer>> compileCompleter)
        Creates a new CommandMethods with the specified execution and completer compilation functions.

        This constructor takes a function that returns a result when executing the command.

        Parameters:
        execute - the function that executes the command and returns a result
        compileCompleter - the function that compiles completers for the command
      • CommandMethods

        public CommandMethods​(java.util.function.Consumer<CommandInput> execute,
                              java.util.function.Function<java.lang.String,​java.util.List<org.jline.reader.Completer>> compileCompleter)
        Creates a new CommandMethods with the specified execution and completer compilation functions.

        This constructor takes a consumer that doesn't return a result when executing the command. The execution function is wrapped to return null after executing the consumer.

        Parameters:
        execute - the consumer that executes the command without returning a result
        compileCompleter - the function that compiles completers for the command
    • Method Detail

      • execute

        public java.util.function.Function<CommandInput,​?> execute()
        Returns the function that executes the command.
        Returns:
        the function that executes the command
      • compileCompleter

        public java.util.function.Function<java.lang.String,​java.util.List<org.jline.reader.Completer>> compileCompleter()
        Returns the function that compiles completers for the command.
        Returns:
        the function that compiles completers for the command