Class OperationRequestHandler

    • Constructor Detail

      • OperationRequestHandler

        public OperationRequestHandler()
    • Method Detail

      • isBatchMode

        public boolean isBatchMode​(CommandContext ctx)
        Description copied from interface: CommandHandler
        Whether the command supports batch mode or not. The result could depend on the context, e.g. it won't make sense to add 'some_command --help' to a batch.
        Specified by:
        isBatchMode in interface CommandHandler
        Parameters:
        ctx - the current context
        Returns:
        true if the command can be added to the batch, otherwise - false.
      • isAvailable

        public boolean isAvailable​(CommandContext ctx)
        Description copied from interface: CommandHandler
        Checks whether the command is available in the current context (e.g. some commands require connection with the controller, some are available only in the batch mode, etc)
        Specified by:
        isAvailable in interface CommandHandler
        Parameters:
        ctx - current context
        Returns:
        true if the command can be executed in the current context, false - otherwise.
      • 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 List<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