net.dpml.cli.builder
Class DefaultOptionBuilder

java.lang.Object
  extended bynet.dpml.cli.builder.DefaultOptionBuilder

public class DefaultOptionBuilder
extends Object

Builds DefaultOption instances.

Version:
1.0.0
Author:
Digital Product Meta Library

Constructor Summary
DefaultOptionBuilder()
          Creates a new DefaultOptionBuilder using defaults
DefaultOptionBuilder(String shortPrefix, String longPrefix, boolean burstEnabled)
          Creates a new DefaultOptionBuilder
 
Method Summary
 DefaultOption create()
          Creates a DefaultOption instance
 DefaultOptionBuilder reset()
          Resets the builder.
 DefaultOptionBuilder withArgument(Argument newArgument)
          Use this Argument
 DefaultOptionBuilder withChildren(Group newChildren)
          Use this child Group
 DefaultOptionBuilder withDescription(String newDescription)
          Use this option description
 DefaultOptionBuilder withId(int newId)
          Sets the id
 DefaultOptionBuilder withLongName(String longName)
          Use this long option name.
 DefaultOptionBuilder withRequired(boolean newRequired)
          Use this optionality
 DefaultOptionBuilder withShortName(String shortName)
          Use this short option name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultOptionBuilder

public DefaultOptionBuilder()
Creates a new DefaultOptionBuilder using defaults

See Also:
DefaultOption.DEFAULT_SHORT_PREFIX, DefaultOption.DEFAULT_LONG_PREFIX, DefaultOption.DEFAULT_BURST_ENABLED

DefaultOptionBuilder

public DefaultOptionBuilder(String shortPrefix,
                            String longPrefix,
                            boolean burstEnabled)
                     throws IllegalArgumentException
Creates a new DefaultOptionBuilder

Parameters:
shortPrefix - the prefix to use for short options
longPrefix - the prefix to use for long options
burstEnabled - whether to allow gnu style bursting
Throws:
IllegalArgumentException - if either prefix is less than on character long
Method Detail

create

public DefaultOption create()
                     throws IllegalStateException
Creates a DefaultOption instance

Returns:
the new instance
Throws:
IllegalStateException - if no names have been supplied

reset

public DefaultOptionBuilder reset()
Resets the builder.

Returns:
this DefaultOptionBuilder.

withShortName

public DefaultOptionBuilder withShortName(String shortName)
Use this short option name. The first name is used as the preferred display name for the Command and then later names are used as aliases.

Parameters:
shortName - the name to use
Returns:
this builder

withLongName

public DefaultOptionBuilder withLongName(String longName)
Use this long option name. The first name is used as the preferred display name for the Command and then later names are used as aliases.

Parameters:
longName - the name to use
Returns:
this builder

withDescription

public DefaultOptionBuilder withDescription(String newDescription)
Use this option description

Parameters:
newDescription - the description to use
Returns:
this builder

withRequired

public DefaultOptionBuilder withRequired(boolean newRequired)
Use this optionality

Parameters:
newRequired - true iff the Option is required
Returns:
this builder

withChildren

public DefaultOptionBuilder withChildren(Group newChildren)
Use this child Group

Parameters:
newChildren - the child Group to use
Returns:
this builder

withArgument

public DefaultOptionBuilder withArgument(Argument newArgument)
Use this Argument

Parameters:
newArgument - the argument to use
Returns:
this builder

withId

public final DefaultOptionBuilder withId(int newId)
Sets the id

Parameters:
newId - the id of the DefaultOption
Returns:
this DefaultOptionBuilder