org.kohsuke.args4j.opts
Class MultiStringOption

java.lang.Object
  extended by org.kohsuke.args4j.opts.MultiStringOption
All Implemented Interfaces:
CmdLineOption

public class MultiStringOption
extends Object
implements CmdLineOption

Option that accompanies a strong value and can be specified multiple times.

For example, you can parse "-J opt1 -J opt2 -J opt3" into {"opt1","opt2","opt3"}.

Author:
Kohsuke Kawaguchi (kk@kohsuke.org)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.kohsuke.args4j.CmdLineOption
CmdLineOption.Parameters
 
Field Summary
 List values
          Read-only view of the data store.
 
Constructor Summary
MultiStringOption(String optionName)
           
MultiStringOption(String optionName, List storage)
          Creates a new MultiStringOption that store values into the specified List.
 
Method Summary
 boolean accepts(String optionName)
          Checks if this option parser recognizes the specified option name.
 int parseArguments(CmdLineParser parser, CmdLineOption.Parameters params)
          Called if the option that this parser recognizes is found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

public final List values
Read-only view of the data store.

Constructor Detail

MultiStringOption

public MultiStringOption(String optionName)

MultiStringOption

public MultiStringOption(String optionName,
                         List storage)
Creates a new MultiStringOption that store values into the specified List.

Method Detail

accepts

public boolean accepts(String optionName)
Description copied from interface: CmdLineOption
Checks if this option parser recognizes the specified option name.

Specified by:
accepts in interface CmdLineOption

parseArguments

public int parseArguments(CmdLineParser parser,
                          CmdLineOption.Parameters params)
                   throws CmdLineException
Description copied from interface: CmdLineOption
Called if the option that this parser recognizes is found.

Specified by:
parseArguments in interface CmdLineOption
Parameters:
parser - The parser that's using this option object. For example, if the option "-quiet" is simply an alias to "-verbose 5", then the implementation can just call the CmdLineParser.parse(String[]) method recursively.
params - The rest of the arguments. This method can use this object to access the arguments of the option if necessary.
Returns:
The number of arguments consumed. For example, return 0 if this option doesn't take any parameter.
Throws:
CmdLineException


Copyright © 2003-2011 Kohsuke Kawaguchi. All Rights Reserved.