A
- the type parameter defining the arguments and options of the
commandpublic abstract class AbstractCommand<A extends Arguments<A>> extends Object implements Command<A>
Constructor and Description |
---|
AbstractCommand(String name,
A arguments)
Constructor with command name, type and arguments.
|
Modifier and Type | Method and Description |
---|---|
A |
getArguments(ExecutionContext context)
Returns the implementation specific command arguments and options for the
given execution context.
|
String |
getName()
Returns the name of this command, usually a lower-case string such as
"grep" or "ls".
|
Command<?> |
join(Command<?> next)
Returns a new command representing the combination of
this
command with next . |
String |
toString()
Returns a string representation of the command instance including the
argument and option values defined for the command.
|
public AbstractCommand(String name, A arguments)
name
- the name of the command, usually a lower case string such as
"ls" or "grep"arguments
- the command specific arguments for the new command instancepublic String getName()
Command
public A getArguments(ExecutionContext context)
Command
VariableContext
returned by the given context
object. No variables are resolved if context
is null.getArguments
in interface Command<A extends Arguments<A>>
context
- the execution context with access to variables and value
converters, or null if no variables should be resolvedArguments.getForContext(ExecutionContext)
public Command<?> join(Command<?> next)
Command
this
command with next
. The returned command executes this
command first and usually joins the output to the next
command's
input.
Note that some commands may use a slightly different interpretation of
"joining a command". The xargs
command for instance uses its
joined command as target command; the values collected by xargs
on its input stream are passed to the target command as arguments instead
of as input.
Copyright © 2024. All rights reserved.