站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

OptionGroups (Command Line Parsing API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.sendopts/2 2.0

org.netbeans.spi.sendopts
Class OptionGroups

java.lang.Object
  extended by org.netbeans.spi.sendopts.OptionGroups

public final class OptionGroups
extends Object

Factory method that composes individual options into groups. In some situations it is useful and sometimes even necessary to enforce certain relationships among options provided by some, potentially different modules. Factory methods defined here in allow such compositions as they take multiple options and convert them into one group option.

The following table gives short overview of the behaviour of different factory methods. Supposed n individual options were passed as arguments to each method. The Min and Max shown the number that is needed for the group option to be "consistent":
Method Min Max
allOf(org.netbeans.spi.sendopts.Option...) n n
oneOf(org.netbeans.spi.sendopts.Option...) 1 1
someOf(org.netbeans.spi.sendopts.Option...) 1 n
anyOf(org.netbeans.spi.sendopts.Option...) 0 n

Please note that the anyOf(org.netbeans.spi.sendopts.Option...) is in fact always consistent, regardless any number of the given options appears on the command line or not. As such it serves slightly different purpose than the other methods listed in the table.

More detailed description of the behaviour of each method is given in their appropriate javadoc.


Method Summary
static Option allOf(Option... options)
          Creates a compound option that forces all of the sub options to appear on the command line.
static Option anyOf(Option... options)
          A voluntary selector that allows any of the specified options to appear on the command line, but if they do not appear, the command line is still consistent.
static Option oneOf(Option... options)
          Creates a selector option that forces exactly one of the sub options to appear on the command line.
static Option someOf(Option... options)
          Combines a set of multiple options into one compound one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

someOf

public static Option someOf(Option... options)
Combines a set of multiple options into one compound one. Useful for OptionProcessor that want to process more than one option and want to do all the logic of choosing which options can be used together with others by themselves. The newly created options will be contained in the map passed to OptionProcessor.process(org.netbeans.spi.sendopts.Env, java.util.Map) method if at least one of the parameters appeared on the command line. The value associated with the compound option is always going to be new String[0], however the map will contain all options that appeared and their values which can then be processed one by one.

Parameters:
options - the sub options to check on the command line
Returns:
compound option that is activated if at least one of the options appears on the command line

anyOf

public static Option anyOf(Option... options)
A voluntary selector that allows any of the specified options to appear on the command line, but if they do not appear, the command line is still consistent. If at least one of the given sub options appears on the command line, the map passed to OptionProcessor.process(org.netbeans.spi.sendopts.Env, java.util.Map) will contain the returned compound option with associated value of new String[0].

Parameters:
options - the sub options to check on the command line
Returns:
compound option that is activated if at least one of the options appears on the command line

oneOf

public static Option oneOf(Option... options)
Creates a selector option that forces exactly one of the sub options to appear on the command line. If more than one of the options appears on the command line, then an error is reported by the infrastructure. If none of the sub options is present than this selector option is not also present. If present in the OptionProcessor.process(org.netbeans.spi.sendopts.Env, java.util.Map)'s map, then the selector option is always associated with new String[0] value, however there is also one of the sub options, with its associated value.

Parameters:
options - the options to select one from
Returns:
the selector option

allOf

public static Option allOf(Option... options)
Creates a compound option that forces all of the sub options to appear on the command line. If less of them is present, an error is reported by the infrastructure. If present in the OptionProcessor.process(org.netbeans.spi.sendopts.Env, java.util.Map)'s map, then the compound option is always associated with new String[0] value, however there are all the sub options, with their associated values.

Parameters:
options - the options to select one from
Returns:
the selector option

org.netbeans.modules.sendopts/2 2.0

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.