Package org.jboss.as.cli.handlers.loop
Class ForHandler
- java.lang.Object
-
- org.jboss.as.cli.handlers.CommandHandlerWithArguments
-
- org.jboss.as.cli.handlers.CommandHandlerWithHelp
-
- org.jboss.as.cli.handlers.loop.ForHandler
-
- All Implemented Interfaces:
CommandHandler
public class ForHandler extends CommandHandlerWithHelp
- Author:
- jfdenise
-
-
Field Summary
-
Fields inherited from class org.jboss.as.cli.handlers.CommandHandlerWithHelp
helpArg
-
-
Constructor Summary
Constructors Constructor Description ForHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doHandle(CommandContext ctx)
boolean
hasArgument(CommandContext ctx, int index)
It has to accept everything since we don't know what kind of command will be edited.boolean
hasArgument(CommandContext ctx, String name)
Checks whether the command handler recognizes the argument by the name.boolean
isAvailable(CommandContext ctx)
Checks whether the command is available in the current context (e.g.-
Methods inherited from class org.jboss.as.cli.handlers.CommandHandlerWithHelp
displayHelp, handle, isBatchMode, printHelp, printList
-
Methods inherited from class org.jboss.as.cli.handlers.CommandHandlerWithArguments
addArgument, getArgument, getArguments, getArgumentsMap, recognizeArguments
-
-
-
-
Method Detail
-
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 interfaceCommandHandler
- Overrides:
isAvailable
in classCommandHandlerWithHelp
- Parameters:
ctx
- current context- Returns:
- true if the command can be executed in the current context, false - otherwise.
-
doHandle
protected void doHandle(CommandContext ctx) throws CommandLineException
- Specified by:
doHandle
in classCommandHandlerWithHelp
- Throws:
CommandLineException
-
hasArgument
public boolean hasArgument(CommandContext ctx, int index)
It has to accept everything since we don't know what kind of command will be edited.- Specified by:
hasArgument
in interfaceCommandHandler
- Overrides:
hasArgument
in classCommandHandlerWithArguments
- Parameters:
ctx
- the current contextindex
- argument index to check- Returns:
- true if the handler accepts an argument with the specified index, otherwise - false.
-
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 interfaceCommandHandler
- Overrides:
hasArgument
in classCommandHandlerWithArguments
- Parameters:
ctx
- the current contextname
- argument name to check- Returns:
- true if the handler recognizes the argument, otherwise - false.
-
-