Package org.jboss.as.cli.handlers
Class CommandHandlerWithArguments
- java.lang.Object
-
- org.jboss.as.cli.handlers.CommandHandlerWithArguments
-
- All Implemented Interfaces:
CommandHandler
- Direct Known Subclasses:
CommandHandlerWithHelp
public abstract class CommandHandlerWithArguments extends Object implements CommandHandler
- Author:
- Alexey Loubyansky
-
-
Constructor Summary
Constructors Constructor Description CommandHandlerWithArguments()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArgument(CommandArgument arg)CommandArgumentgetArgument(CommandContext ctx, String name)Returns command argument declared by the command handler corresponding to the argument name.Collection<CommandArgument>getArguments(CommandContext ctx)Returns a collection of the command arguments the handler supports in the current context.protected Map<String,CommandArgument>getArgumentsMap(CommandContext ctx)booleanhasArgument(CommandContext ctx, int index)Checks whether the command handler accepts an argument with the specified index.booleanhasArgument(CommandContext ctx, String name)Checks whether the command handler recognizes the argument by the name.protected voidrecognizeArguments(CommandContext ctx)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.as.cli.CommandHandler
handle, isAvailable, isBatchMode
-
-
-
-
Method Detail
-
addArgument
public void addArgument(CommandArgument arg)
-
getArgument
public CommandArgument getArgument(CommandContext ctx, String name)
Description copied from interface:CommandHandlerReturns 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:
getArgumentin interfaceCommandHandler- Parameters:
ctx- the current contextname- 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:CommandHandlerChecks whether the command handler recognizes the argument by the name.- Specified by:
hasArgumentin interfaceCommandHandler- Parameters:
ctx- the current contextname- 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:CommandHandlerChecks whether the command handler accepts an argument with the specified index.- Specified by:
hasArgumentin interfaceCommandHandler- Parameters:
ctx- the current contextindex- 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:CommandHandlerReturns a collection of the command arguments the handler supports in the current context.- Specified by:
getArgumentsin interfaceCommandHandler- Parameters:
ctx- current command line context- Returns:
- list of the command arguments supported in the current context
-
recognizeArguments
protected void recognizeArguments(CommandContext ctx) throws CommandFormatException
- Throws:
CommandFormatException
-
getArgumentsMap
protected Map<String,CommandArgument> getArgumentsMap(CommandContext ctx)
-
-