Package org.jboss.as.cli.handlers.ifelse
Class IfHandler
- java.lang.Object
-
- org.jboss.as.cli.handlers.CommandHandlerWithArguments
-
- org.jboss.as.cli.handlers.CommandHandlerWithHelp
-
- org.jboss.as.cli.handlers.ifelse.IfHandler
-
- All Implemented Interfaces:
CommandHandler
public class IfHandler extends CommandHandlerWithHelp
- Author:
- Alexey Loubyansky
-
-
Field Summary
-
Fields inherited from class org.jboss.as.cli.handlers.CommandHandlerWithHelp
helpArg
-
-
Constructor Summary
Constructors Constructor Description IfHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoHandle(CommandContext ctx)ConditionArgumentgetConditionArgument()booleanhasArgument(CommandContext ctx, int index)It has to accept everything since we don't know what kind of command will be edited.booleanhasArgument(CommandContext ctx, String name)Checks whether the command handler recognizes the argument by the name.booleanisAvailable(CommandContext ctx)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)-
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
-
getConditionArgument
public ConditionArgument getConditionArgument()
-
isAvailable
public boolean isAvailable(CommandContext ctx)
Description copied from interface:CommandHandlerChecks 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:
isAvailablein interfaceCommandHandler- Overrides:
isAvailablein 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:
doHandlein 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:
hasArgumentin interfaceCommandHandler- Overrides:
hasArgumentin 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:CommandHandlerChecks whether the command handler recognizes the argument by the name.- Specified by:
hasArgumentin interfaceCommandHandler- Overrides:
hasArgumentin classCommandHandlerWithArguments- Parameters:
ctx- the current contextname- argument name to check- Returns:
- true if the handler recognizes the argument, otherwise - false.
-
-