public class StringArrayOptionHandler extends OptionHandler<String>
An OptionHandler
for greedily mapping a list of tokens into a collection of String
s
(such as String[]
, List<String>
, etc.).
Example for parameter -s
, which is type String[]
:
java -jar aaa.jar -s banan hruska jablko
java -jar aaa.jar -s banan "hruska jablko"
java -jar aaa.jar -s "banan hruska jablko"
java -jar aaa.jar -s banan hruska jablko -l 4 -r
java -jar aaa.jar -t 222 -s banan hruska jablko -r
All of them result in a single string array that contains three tokens:
banan
, hruska
, and jablko
.
This OptionHandler
scans for parameter which begins with -. If found, it will stop.
option, owner, setter
Constructor and Description |
---|
StringArrayOptionHandler(CmdLineParser parser,
OptionDef option,
Setter<String> setter) |
Modifier and Type | Method and Description |
---|---|
String |
getDefaultMetaVariable()
Returns
"STRING[]" . |
int |
parseArguments(Parameters params)
Tries to parse
String[] argument from Parameters . |
getMetaVariable, getNameAndMeta, getNameAndMeta, print, printDefaultValue
public StringArrayOptionHandler(CmdLineParser parser, OptionDef option, Setter<String> setter)
public String getDefaultMetaVariable()
"STRING[]"
.getDefaultMetaVariable
in class OptionHandler<String>
public int parseArguments(Parameters params) throws CmdLineException
String[]
argument from Parameters
.parseArguments
in class OptionHandler<String>
params
- The rest of the arguments. This method can use this
object to access the arguments of the option if necessary.
The object is valid only during the method call.0
if this option doesn't take any parameters.)CmdLineException
Copyright © 2003-2016 Kohsuke Kawaguchi. All Rights Reserved.