net.dpml.cli.builder
Class SwitchBuilder

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

public class SwitchBuilder
extends Object

Builds Switch instance.

Version:
1.0.0
Author:
Digital Product Meta Library

Constructor Summary
SwitchBuilder()
          Creates a new SwitchBuilder using defaults.
SwitchBuilder(String enabledPrefix, String disabledPrefix)
          Creates a new SwitchBuilder
 
Method Summary
 Switch create()
          Creates a new Switch instance
 SwitchBuilder reset()
          Resets the builder.
 SwitchBuilder withArgument(Argument newArgument)
          Use this Argument
 SwitchBuilder withChildren(Group newChildren)
          Use this child Group
 SwitchBuilder withDescription(String newDescription)
          Use this option description
 SwitchBuilder withId(int newId)
          Sets the id
 SwitchBuilder withName(String name)
          Use this option name.
 SwitchBuilder withRequired(boolean newRequired)
          Use this optionality
 SwitchBuilder withSwitchDefault(Boolean newSwitchDefault)
          Sets the default state for this switch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwitchBuilder

public SwitchBuilder()
Creates a new SwitchBuilder using defaults.

See Also:
Switch.DEFAULT_ENABLED_PREFIX, Switch.DEFAULT_DISABLED_PREFIX

SwitchBuilder

public SwitchBuilder(String enabledPrefix,
                     String disabledPrefix)
              throws IllegalArgumentException
Creates a new SwitchBuilder

Parameters:
enabledPrefix - the prefix to use for enabling the option
disabledPrefix - the prefix to use for disabling the option
Throws:
IllegalArgumentException - if either prefix is less than 1 character long or the prefixes match
Method Detail

create

public Switch create()
Creates a new Switch instance

Returns:
a new Switch instance

reset

public SwitchBuilder reset()
Resets the builder.

Returns:
the builder

withDescription

public SwitchBuilder withDescription(String newDescription)
Use this option description

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

withName

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

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

withRequired

public SwitchBuilder withRequired(boolean newRequired)
Use this optionality

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

withArgument

public SwitchBuilder withArgument(Argument newArgument)
Use this Argument

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

withChildren

public SwitchBuilder withChildren(Group newChildren)
Use this child Group

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

withId

public final SwitchBuilder withId(int newId)
Sets the id

Parameters:
newId - the id of the Switch
Returns:
this SwitchBuilder

withSwitchDefault

public final SwitchBuilder withSwitchDefault(Boolean newSwitchDefault)
Sets the default state for this switch

Parameters:
newSwitchDefault - the default state
Returns:
this SwitchBuilder