|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME)
@Documented
@Target(value={FIELD,METHOD})
public @interface CliArgument
A 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.
E.g. a program Foo may have one argument of
type and you
invoke List<File>Foo file1 file2 file3 then the property is set to a
List equivalent to
{new File("file1"), new File("file2"), new File("file3")}.
ATTENTION:
Whenever possible prefer a 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.
| Required Element Summary | |
|---|---|
String |
name
The name of the argument used for help usage output. |
String |
usage
The description of this argument for help usage. |
| Optional Element Summary | |
|---|---|
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. via addCloseTo(). |
String |
mode
The mode of this argument. |
boolean |
required
The flag that indicates if this argument is required. |
| Element Detail |
|---|
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 addCloseTo
name of the argument where to add this
CliArgument in the list of arguments. The default is
ID_LAST.
ID_FIRST,
ID_LASTpublic 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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||