Modifier and Type | Optional Element and Description |
---|---|
String |
defVal
Specify the default value in String.
|
String |
errorTemplate
Specify the error message template when it failed to resolve option value to the required argument.
|
String |
help
Specify the help message for this option
|
String[] |
lead
Specify the argument lead, e.g.
|
String |
value
Alias of
help() |
public abstract String[] lead
Specify the argument lead, e.g.
@Command("account.show")
public List<Account> listAccount(
@Optional({"-q", "--query"}) String q,
@Optional(value = "-l, --limit", defVal = "-1") int limit
) {
Query query = new Query();
if (null != q) {
query.filter("text", q);
}
if (limit > -1) {
query.limit(limit);
}
return Account.find(query).asList();
}
If not specified, then the system will assume the argument lead to be follows
-o
, where “o” is the first char of the argument name--option
, where “option” is the full argument namepublic abstract String help
Specify the help message for this option
public abstract String errorTemplate
Specify the error message template when it failed to resolve option value to the required argument.
The template must have one %s
template variable to put in the invalid value
Copyright © 2014–2018 ActFramework. All rights reserved.