Class CommandHandlerWithArguments

    • Constructor Detail

      • CommandHandlerWithArguments

        public CommandHandlerWithArguments()
    • Method Detail

      • getArgument

        public CommandArgument getArgument​(CommandContext ctx,
                                           String name)
        Description copied from interface: CommandHandler
        Returns command argument declared by the command handler corresponding to the argument name. Or null if the argument wasn't found among the accepted arguments.
        Specified by:
        getArgument in interface CommandHandler
        Parameters:
        ctx - the current context
        name - the name of the argument
        Returns:
        command argument corresponding to the argument name or null if the argument name wasn't recognized.
      • hasArgument

        public boolean hasArgument​(CommandContext ctx,
                                   String name)
        Description copied from interface: CommandHandler
        Checks whether the command handler recognizes the argument by the name.
        Specified by:
        hasArgument in interface CommandHandler
        Parameters:
        ctx - the current context
        name - argument name to check
        Returns:
        true if the handler recognizes the argument, otherwise - false.
      • hasArgument

        public boolean hasArgument​(CommandContext ctx,
                                   int index)
        Description copied from interface: CommandHandler
        Checks whether the command handler accepts an argument with the specified index.
        Specified by:
        hasArgument in interface CommandHandler
        Parameters:
        ctx - the current context
        index - argument index to check
        Returns:
        true if the handler accepts an argument with the specified index, otherwise - false.
      • getArguments

        public Collection<CommandArgument> getArguments​(CommandContext ctx)
        Description copied from interface: CommandHandler
        Returns a collection of the command arguments the handler supports in the current context.
        Specified by:
        getArguments in interface CommandHandler
        Parameters:
        ctx - current command line context
        Returns:
        list of the command arguments supported in the current context