org.apache.commons.cli
Class OptionGroup

java.lang.Object
  extended byorg.apache.commons.cli.OptionGroup

public class OptionGroup
extends Object

A group of mutually exclusive options.

Version:
$Revision: 542144 $
Author:
John Keyes ( john at integralsource.com )

Constructor Summary
OptionGroup()
           
 
Method Summary
 OptionGroup addOption(Option opt)
          add opt to this group
 Collection getNames()
           
 Collection getOptions()
           
 String getSelected()
           
 boolean isRequired()
          Returns whether this option group is required.
 void setRequired(boolean required)
           
 void setSelected(Option opt)
          set the selected option of this group to name.
 String toString()
          Returns the stringified version of this OptionGroup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OptionGroup

public OptionGroup()
Method Detail

addOption

public OptionGroup addOption(Option opt)
add opt to this group

Parameters:
opt - the option to add to this group
Returns:
this option group with opt added

getNames

public Collection getNames()
Returns:
the names of the options in this group as a Collection

getOptions

public Collection getOptions()
Returns:
the options in this group as a Collection

setSelected

public void setSelected(Option opt)
                 throws AlreadySelectedException
set the selected option of this group to name.

Parameters:
opt - the option that is selected
Throws:
AlreadySelectedException - if an option from this group has already been selected.

getSelected

public String getSelected()
Returns:
the selected option name

setRequired

public void setRequired(boolean required)
Parameters:
required - specifies if this group is required

isRequired

public boolean isRequired()
Returns whether this option group is required.

Returns:
whether this option group is required

toString

public String toString()

Returns the stringified version of this OptionGroup.

Returns:
the stringified representation of this group


Copyright © 2002-2007 Apache Software Foundation. All Rights Reserved.