net.dpml.cli.builder

Class DefaultOptionBuilder

public class DefaultOptionBuilder extends Object

Builds DefaultOption instances.

Version: @PROJECT-VERSION@

Author: @PUBLISHER-NAME@

Constructor Summary
DefaultOptionBuilder()
Creates a new DefaultOptionBuilder using defaults
DefaultOptionBuilder(String shortPrefix, String longPrefix, boolean burstEnabled)
Creates a new DefaultOptionBuilder
Method Summary
DefaultOptioncreate()
Creates a DefaultOption instance
DefaultOptionBuilderreset()
Resets the builder.
DefaultOptionBuilderwithArgument(Argument newArgument)
Use this Argument
DefaultOptionBuilderwithChildren(Group newChildren)
Use this child Group
DefaultOptionBuilderwithDescription(String newDescription)
Use this option description
DefaultOptionBuilderwithId(int newId)
Sets the id
DefaultOptionBuilderwithLongName(String longName)
Use this long option name.
DefaultOptionBuilderwithRequired(boolean newRequired)
Use this optionality
DefaultOptionBuilderwithShortName(String shortName)
Use this short option name.

Constructor Detail

DefaultOptionBuilder

public DefaultOptionBuilder()
Creates a new DefaultOptionBuilder using defaults

See Also: DEFAULT_SHORT_PREFIX DEFAULT_LONG_PREFIX DEFAULT_BURST_ENABLED

DefaultOptionBuilder

public DefaultOptionBuilder(String shortPrefix, String longPrefix, boolean burstEnabled)
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()
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.

withArgument

public DefaultOptionBuilder withArgument(Argument newArgument)
Use this Argument

Parameters: newArgument the argument to use

Returns: this builder

withChildren

public DefaultOptionBuilder withChildren(Group newChildren)
Use this child Group

Parameters: newChildren the child Group to use

Returns: this builder

withDescription

public DefaultOptionBuilder withDescription(String newDescription)
Use this option description

Parameters: newDescription the description 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

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

withRequired

public DefaultOptionBuilder withRequired(boolean newRequired)
Use this optionality

Parameters: newRequired true iff the Option is required

Returns: this builder

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