public interface Operand<T> extends org.refcodes.mixin.ValueAccessor<T>, org.refcodes.mixin.DescriptionAccessor, org.refcodes.mixin.TypeAccessor, Syntaxable, ArgsAccessor, Comparable<Operand<?>>
Operand
represents a value parsed from command line arguments. In
comparison to an Option
an Operand
just represents a plain
value without an identifier in front of it. An Operand
has a state
which changes with each invocation of the Syntaxable.parseArgs(String[])
method.
It is recommended to put your Operand
instance(s) at the end of your
top Condition
to enforce it to be the last Syntaxable
(s) when
parsing the command line arguments - this makes sure that any Option
s
pick their option arguments so that the Operand
(s) will correctly be
left over for parsing command line argument(s); the Operand
will not
pick by mistake an option argument.
org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B extends org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B>>, org.refcodes.mixin.ValueAccessor.ValueMutator<V>, org.refcodes.mixin.ValueAccessor.ValueProperty<V>
org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B extends org.refcodes.mixin.DescriptionAccessor.DescriptionBuilder<B>>, org.refcodes.mixin.DescriptionAccessor.DescriptionMutator, org.refcodes.mixin.DescriptionAccessor.DescriptionProperty
org.refcodes.mixin.TypeAccessor.TypeMutator, org.refcodes.mixin.TypeAccessor.TypeProperty
ArgsAccessor.ArgsMutator, ArgsAccessor.ArgsProperty
Modifier and Type | Method and Description |
---|---|
String[] |
getArgs()
When being parsed via the
Syntaxable.parseArgs(String[]) method, then the
getArgs() method returns the command line arguments representing
this Operand instance (also including the short or the long
options, see Operand ). |
String |
getParameterName()
|
T |
getValue()
When being parsed via the
Syntaxable.parseArgs(String[]) method, then the
getValue() method returns the parsed value. |
default boolean |
hasValue()
When being parsed via the
Syntaxable.parseArgs(String[]) method, use this
method to determine whether the getValue() method contains
parsed value. |
parseArgs, parseSyntax, toState, toSyntax
compareTo
T getValue()
Syntaxable.parseArgs(String[])
method, then the
getValue()
method returns the parsed value.getValue
in interface org.refcodes.mixin.ValueAccessor<T>
Syntaxable.parseArgs(String[])
method.default boolean hasValue()
Syntaxable.parseArgs(String[])
method, use this
method to determine whether the getValue()
method contains
parsed value.Syntaxable.parseArgs(String[])
method.String[] getArgs()
Syntaxable.parseArgs(String[])
method, then the
getArgs()
method returns the command line arguments representing
this Operand
instance (also including the short or the long
options, see Operand
).getArgs
in interface ArgsAccessor
Operand
instance.String getParameterName()
Operand
) or the option argument (Option
),
depending on the sub-type inheriting from this interface. The parameter
name is merely used for constructing the command line arguments syntax
String
via Syntaxable.toSyntax(SyntaxNotation)
and the command line
arguments detail description when creating a command line tool's help
output.Copyright © 2017. All rights reserved.