@Retention(value=RUNTIME) @Documented @Target(value={FIELD,METHOD}) public @interface CliArgument
CliArgument
is used to annotate a property (member variable of some class or setter-method) that should be
set from a main-program via a commandline argument. Unlike CliOption
a CliArgument
is NOT triggered
by its name
but is identified by its position. The first commandline parameter that is no
option
or occurs after the argument "--" is treated as the first argument and further parameters
can also only be arguments
. Additionally the last CliArgument
-property can have the type
List
if a proper generic is used to declare the item-type. Foo
may have one argument
of type List
<
File
> and you invoke Foo file1 file2 file3
then the property is set to a
List
equivalent to {new File("file1"), new File("file2"), new File("file3")
}. CliOption
over a CliArgument
. However having a single CliArgument
is just fine. But having multiple arguments
together in some mode
can cause
maintenance trouble. This is only supported to avoid limitations (e.g. if you want to implement something like
"grep pattern [file]+") but NOT recommended.Modifier and Type | Fields and Description |
---|---|
static String |
ID_FIRST
Symbolic name used for
addCloseTo() to identify the first argument. |
static String |
ID_LAST
Symbolic name used for
addCloseTo() to identify the last argument. |
Modifier and Type | Required Element and Description |
---|---|
String |
name
The name of the argument used for help usage output.
|
String |
usage
The description of this argument for
help usage . |
Modifier and Type | Optional Element and Description |
---|---|
boolean |
addAfter
Determines if this
CliArgument should be add after ( true ) or before ( false ) the
argument identified by addCloseTo() . |
String |
addCloseTo
The
name of the argument where to add this CliArgument in the list of arguments. |
CliContainerStyle |
containerStyle
The
style of this argument if it has a container type. |
String |
id
The ID of the argument used to identify the argument e.g.
|
String |
mode
The mode of this argument.
|
boolean |
required
The flag that indicates if this argument is required.
|
public static final String ID_FIRST
addCloseTo()
to identify the first argument.public static final String ID_LAST
addCloseTo()
to identify the last argument.public abstract String name
public abstract String usage
help usage
. It should be an
internationalized message
that will be
localized using NlsMessage
.
NLS-arguments
are "default" for the default value.public abstract String id
addCloseTo()
. The default is the empty
string that is treated as if the ID is set to the same value as name()
.public abstract boolean addAfter
CliArgument
should be add after ( true
) or before ( false
) the
argument
identified by addCloseTo()
.public abstract String mode
CliOption.mode()
public abstract boolean required
true
. Use a value of
false
to make this argument optional within it's mode
. options
instead. If you use optional arguments anyway, please
note that potentially following options also need to be optional then.CliMode.parentIds()
public abstract CliContainerStyle containerStyle
style
of this argument if it has a container type. The default is
CliContainerStyle.DEFAULT
.CliStyle.containerStyle()
Copyright © 2001–2016 mmm-Team. All rights reserved.