net.dpml.cli.builder

Class SwitchBuilder

public class SwitchBuilder extends 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
Switchcreate()
Creates a new Switch instance
SwitchBuilderreset()
Resets the builder.
SwitchBuilderwithArgument(Argument newArgument)
Use this Argument
SwitchBuilderwithChildren(Group newChildren)
Use this child Group
SwitchBuilderwithDescription(String newDescription)
Use this option description
SwitchBuilderwithId(int newId)
Sets the id
SwitchBuilderwithName(String name)
Use this option name.
SwitchBuilderwithRequired(boolean newRequired)
Use this optionality
SwitchBuilderwithSwitchDefault(Boolean newSwitchDefault)
Sets the default state for this switch

Constructor Detail

SwitchBuilder

public SwitchBuilder()
Creates a new SwitchBuilder using defaults.

See Also: DEFAULT_ENABLED_PREFIX DEFAULT_DISABLED_PREFIX

SwitchBuilder

public SwitchBuilder(String enabledPrefix, String disabledPrefix)
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

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