Class AbstractCommandHandler
java.lang.Object
com.pnfsoftware.jeb.util.interpreter.AbstractCommandHandler
- All Implemented Interfaces:
ICommandHandler,ICommandNode
Skeleton for a command handler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected List<CommandParameter>protected ICommandManagerFields inherited from interface com.pnfsoftware.jeb.util.interpreter.ICommandNode
QUOTES_AS_NORMAL_CHAR -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommandHandler(ICommandManager parent, String name) AbstractCommandHandler(ICommandManager parent, String name, CommandParameter[] params, String help, String helpDetails) AbstractCommandHandler(ICommandManager parent, String name, String help) AbstractCommandHandler(ICommandManager parent, String name, String[] paramNames, String help, String helpDetails) -
Method Summary
Modifier and TypeMethodDescriptionaddParameter(CommandParameter parameter) addParameter(String paramName) getHelp()Retrieve a short help that describes the commandGive additional details (used when "help $command" is called).getName()Retrieve the name of the command (used to invoke the command)intstatic StringgetParameter(List<InputToken> tokens, int i) Get a parameter.intgetParameterIndex(String paramName, String prefix) Retrieve the list of parameters available for this commandstatic StringgetParameterSafe(List<InputToken> tokens, int i) Get a parameter, never return null.Retrieve the parent, that is, this node's manager.static InputTokengetToken(List<InputToken> tokens, int i) parseInputToken(List<InputToken> tokens) parseInputToken(List<InputToken> tokens, boolean failOnErrors) Assign the inputToken value in the same index as innerCommandParameterlist.protected voidprotected voidsetOptions(int options) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pnfsoftware.jeb.util.interpreter.ICommandNode
execute
-
Field Details
-
parent
-
name
-
params
-
help
-
helpDetails
-
-
Constructor Details
-
AbstractCommandHandler
-
AbstractCommandHandler
-
AbstractCommandHandler
public AbstractCommandHandler(ICommandManager parent, String name, String[] paramNames, String help, String helpDetails) -
AbstractCommandHandler
public AbstractCommandHandler(ICommandManager parent, String name, CommandParameter[] params, String help, String helpDetails)
-
-
Method Details
-
parseInputToken
-
parseInputToken
Assign the inputToken value in the same index as innerCommandParameterlist. Note that the result array can have a bigger size than innerCommandParameterlist if the lastCommandParameteritem allow Multiple parameters.- Parameters:
failOnErrors- set to false if you allow missing parameter after a prefixed parameter (used for autocompletion) or missing mandatory parameters
-
getParent
Description copied from interface:ICommandNodeRetrieve the parent, that is, this node's manager.- Specified by:
getParentin interfaceICommandNode- Returns:
-
getChildren
- Specified by:
getChildrenin interfaceICommandNode- Returns:
-
getName
Description copied from interface:ICommandNodeRetrieve the name of the command (used to invoke the command)- Specified by:
getNamein interfaceICommandNode- Returns:
-
setName
-
getHelp
Description copied from interface:ICommandNodeRetrieve a short help that describes the command- Specified by:
getHelpin interfaceICommandNode- Returns:
-
setHelp
-
getHelpDetails
Description copied from interface:ICommandHandlerGive additional details (used when "help $command" is called). Please provide the most details to help user: any trick, return format.- Specified by:
getHelpDetailsin interfaceICommandHandler
-
getParameters
Description copied from interface:ICommandHandlerRetrieve the list of parameters available for this command- Specified by:
getParametersin interfaceICommandHandler
-
getParameterIndex
-
addParameter
-
addParameter
-
toString
-
getToken
-
getParameter
Get a parameter.- Parameters:
tokens-i-- Returns:
- the parameter, null on error
-
getParameterSafe
Get a parameter, never return null.- Parameters:
tokens-i-- Returns:
- the parameter, or the empty string on error
-
getOptions
public int getOptions()- Specified by:
getOptionsin interfaceICommandNode- Returns:
-
setOptions
-