net.dpml.cli.builder

Class SwitchBuilder


public class SwitchBuilder
extends java.lang.Object

Builds Switch instance.
Version:
@PROJECT-VERSION@
Author:
@PUBLISHER-NAME@

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

Constructor Details

SwitchBuilder

public SwitchBuilder()
Creates a new SwitchBuilder using defaults.

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

Method Details

create

public Switch create()
Creates a new Switch instance
Returns:
a new Switch instance

reset

public SwitchBuilder reset()
Resets the builder.
Returns:
the 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

withDescription

public SwitchBuilder withDescription(String newDescription)
Use this option description
Parameters:
newDescription - the description 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

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

withSwitchDefault

public final SwitchBuilder withSwitchDefault(Boolean newSwitchDefault)
Sets the default state for this switch
Parameters:
newSwitchDefault - the default state
Returns:
this SwitchBuilder