public final class EchoArguments extends Object implements Arguments<EchoArguments>
echo
command.Constructor and Description |
---|
EchoArguments()
Constructor to use if no options are specified.
|
EchoArguments(EchoOptions options)
Constructor with option set containing the selected command options.
|
EchoArguments(String... args)
Constructor string arguments encoding options and arguments, possibly
also containing variable expressions.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getArgs()
Returns the
<args> operand value: String arguments defining the options for the command and the
strings to be written to the output. |
EchoArguments |
getForContext(ExecutionContext context)
Returns an arguments object for the given execution context with resolved
variables if necessary and possible.
|
EchoOptions |
getOptions()
Returns the options set containing the selected command options.
|
String |
getString()
Returns the
<string> operand value (variables are NOT resolved): A string to be written to standard output. |
String |
getString(ExecutionContext context)
Returns the
<string> (variables are resolved): A string to be written to standard output. |
String[] |
getStrings()
Returns the
<strings> operand value: Strings to be written to standard output, separated by single blank
characters. |
boolean |
isArgsSet()
Returns true if the
<args> operand has been set. |
boolean |
isNoNewline()
Returns true if the
-- noNewline option
is set. |
boolean |
isStringSet()
Returns true if the
<string> operand has been set. |
boolean |
isStringsSet()
Returns true if the
<strings> operand has been set. |
void |
setString(String string)
Sets
<string> : A string to be written to standard output. |
void |
setStrings(String... strings)
Sets
<strings> : Strings to be written to standard output, separated by single blank
characters. |
String |
toString()
Returns a string representation of the command arguments and options.
|
public EchoArguments()
public EchoArguments(EchoOptions options)
options
- the selected optionsNullPointerException
- if the argument is nullpublic EchoArguments(String... args)
args
- string arguments for the commandNullPointerException
- if args is nullpublic EchoOptions getOptions()
public EchoArguments getForContext(ExecutionContext context)
Arguments
this
arguments instance is simply returned.
If variables are present, they are resolved if such a variable is defined
in the VariableContext
returned by
context.
getVariableContext()
.
Values are converted if necessary with the ValueConverter
s
returned by
context.
getValueConverterFor(Class)
.
getForContext
in interface Arguments<EchoArguments>
context
- the execution context providing access to variables and
converterspublic String getString()
<string>
operand value (variables are NOT resolved): A string to be written to standard output.<string>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setgetString(ExecutionContext)
public String getString(ExecutionContext context)
<string>
(variables are resolved): A string to be written to standard output.context
- the execution context used to resolve variables<string>
operand value after resolving variablesIllegalStateException
- if this operand has never been setgetString()
public boolean isStringSet()
<string>
operand has been set.
Note that this method returns true even if null
was passed to the
setString(String)
method.
<string>
operand has
been called at least oncepublic void setString(String string)
<string>
: A string to be written to standard output.string
- the value for the <string>
operandpublic String[] getStrings()
<strings>
operand value: Strings to be written to standard output, separated by single blank
characters.<strings>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isStringsSet()
<strings>
operand has been set.
Note that this method returns true even if null
was passed to the
setStrings(String[])
method.
<strings>
operand has
been called at least oncepublic void setStrings(String... strings)
<strings>
: Strings to be written to standard output, separated by single blank
characters.strings
- the value for the <strings>
operandpublic String[] getArgs()
<args>
operand value: String arguments defining the options for the command and the
strings to be written to the output. Options can be specified by
acronym (with a leading dash "-") or by long name (with two leading
dashes "--").<args>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isArgsSet()
<args>
operand has been set.<args>
operand has
been called at least oncepublic boolean isNoNewline()
--
noNewline
option
is set. The option is also known as -
n option.
Description: Do not print the trailing newline character(s).
--noNewline
or -n
option is setpublic String toString()
Arguments
toString
in interface Arguments<EchoArguments>
toString
in class Object
Copyright © 2024. All rights reserved.