Class QCommandContext
java.lang.Object
com.io7m.quarrel.core.internal.QCommandContext
- All Implemented Interfaces:
QCommandContextType, QLocalizationType
A basic command context implementation.
-
Constructor Summary
ConstructorsConstructorDescriptionQCommandContext(SortedMap<String, QCommandOrGroupType> inTree, QValueConverterDirectoryType inConverters, PrintWriter inOutput, QCommandType inCommand, QLocalizationType inLocalization, Map<QParameterNamedType<?>, List<Object>> inParsedNamedValues, QParametersPositionalType inPositionalParameters, List<Object> inParsedPositionalValues, List<String> inRawPositionalValues) A basic command context implementation. -
Method Summary
Modifier and TypeMethodDescriptioncommand()execute()Execute the command.format(QStringType string, Object... arguments) Localize and format the given string.localize(QStringType string) Localize the given string.output()<T> Optional<T> parameterValue(QParameterNamed01<T> parameter) <T> TparameterValue(QParameterNamed1<T> parameter) <T> TparameterValue(QParameterPositional<T> parameter) <T> TparameterValueRequireNow(QParameterNamed01<T> parameter) <T> List<T> parameterValues(QParameterNamed0N<T> parameter) <T> List<T> parameterValues(QParameterNamed1N<T> parameter) The value converters used to produce this context.
-
Constructor Details
-
QCommandContext
public QCommandContext(SortedMap<String, QCommandOrGroupType> inTree, QValueConverterDirectoryType inConverters, PrintWriter inOutput, QCommandType inCommand, QLocalizationType inLocalization, Map<QParameterNamedType<?>, List<Object>> inParsedNamedValues, QParametersPositionalType inPositionalParameters, List<Object> inParsedPositionalValues, List<String> inRawPositionalValues) A basic command context implementation.- Parameters:
inTree- The command treeinConverters- The value convertersinOutput- The outputinCommand- The commandinLocalization- A localizerinParsedNamedValues- The parsed named valuesinPositionalParameters- The positional parametersinParsedPositionalValues- The parsed positional valuesinRawPositionalValues- The raw positional values
-
-
Method Details
-
commandTree
- Specified by:
commandTreein interfaceQCommandContextType- Returns:
- Access to the command tree
-
output
- Specified by:
outputin interfaceQCommandContextType- Returns:
- The output writer
-
valueConverters
Description copied from interface:QCommandContextTypeThe value converters used to produce this context.- Specified by:
valueConvertersin interfaceQCommandContextType- Returns:
- The value converters
-
command
- Specified by:
commandin interfaceQCommandContextType- Returns:
- The command to which this context belongs
-
parametersPositionalRaw
- Specified by:
parametersPositionalRawin interfaceQCommandContextType- Returns:
- The raw positional parameters, if any
-
parameterValue
- Specified by:
parameterValuein interfaceQCommandContextType- Type Parameters:
T- The parameter type- Parameters:
parameter- The parameter- Returns:
- The value for the parameter
-
parameterValue
- Specified by:
parameterValuein interfaceQCommandContextType- Type Parameters:
T- The parameter type- Parameters:
parameter- The parameter- Returns:
- The value for the parameter
-
parameterValue
- Specified by:
parameterValuein interfaceQCommandContextType- Type Parameters:
T- The parameter type- Parameters:
parameter- The parameter- Returns:
- The value for the parameter, if one was provided
-
parameterValues
- Specified by:
parameterValuesin interfaceQCommandContextType- Type Parameters:
T- The parameter type- Parameters:
parameter- The parameter- Returns:
- The values for the parameter
-
parameterValues
- Specified by:
parameterValuesin interfaceQCommandContextType- Type Parameters:
T- The parameter type- Parameters:
parameter- The parameter- Returns:
- The values for the parameter
-
execute
Description copied from interface:QCommandContextTypeExecute the command.- Specified by:
executein interfaceQCommandContextType- Returns:
- The result of execution
- Throws:
Exception- On errors
-
parameterValueRequireNow
- Specified by:
parameterValueRequireNowin interfaceQCommandContextType- Type Parameters:
T- The parameter type- Parameters:
parameter- The parameter- Returns:
- The value for the parameter
- Throws:
QException- On errors
-
localize
Description copied from interface:QLocalizationTypeLocalize the given string.- Specified by:
localizein interfaceQLocalizationType- Parameters:
string- The string- Returns:
- The string
-
format
Description copied from interface:QLocalizationTypeLocalize and format the given string. The localized string is treated as a format string, and formatted usingMessageFormat.- Specified by:
formatin interfaceQLocalizationType- Parameters:
string- The stringarguments- The arguments- Returns:
- The string
-