net.dpml.cli.builder

Class CommandBuilder


public class CommandBuilder
extends java.lang.Object

Builds Command instances
Version:
@PROJECT-VERSION@
Author:
@PUBLISHER-NAME@

Constructor Summary

CommandBuilder()
Creates a new CommandBuilder instance.

Method Summary

Command
create()
Creates a new Command instance using the properties of the CommandBuilder.
CommandBuilder
reset()
Resets the CommandBuilder to the defaults for a new Command.
CommandBuilder
withArgument(Argument newArgument)
Specifies the argument for the next Command that is created.
CommandBuilder
withChildren(Group newChildren)
Specifies the children for the next Command that is created.
CommandBuilder
withDescription(String newDescription)
Specifies the description for the next Command that is created.
CommandBuilder
withId(int newId)
Specifies the id for the next Command that is created.
CommandBuilder
withName(String name)
Specifies the name for the next Command that is created.
CommandBuilder
withRequired(boolean newRequired)
Specifies whether the next Command created is required or not.

Constructor Details

CommandBuilder

public CommandBuilder()
Creates a new CommandBuilder instance.

Method Details

create

public Command create()
Creates a new Command instance using the properties of the CommandBuilder.
Returns:
the new Command instance

reset

public CommandBuilder reset()
Resets the CommandBuilder to the defaults for a new Command. This method is called automatically at the end of the create method.
Returns:
this CommandBuilder.

withArgument

public CommandBuilder withArgument(Argument newArgument)
Specifies the argument for the next Command that is created.
Parameters:
newArgument - the argument for the next Command that is created.
Returns:
this CommandBuilder.

withChildren

public CommandBuilder withChildren(Group newChildren)
Specifies the children for the next Command that is created.
Parameters:
newChildren - the child options for the next Command that is created.
Returns:
this CommandBuilder.

withDescription

public CommandBuilder withDescription(String newDescription)
Specifies the description for the next Command that is created. This description is used to produce help documentation for the Command.
Parameters:
newDescription - the description for the next Command that is created.
Returns:
this CommandBuilder.

withId

public final CommandBuilder withId(int newId)
Specifies the id for the next Command that is created.
Parameters:
newId - the id for the next Command that is created.
Returns:
this CommandBuilder.

withName

public CommandBuilder withName(String name)
Specifies the name for the next Command that is created. 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 for the next Command that is created.
Returns:
this CommandBuilder.

withRequired

public CommandBuilder withRequired(boolean newRequired)
Specifies whether the next Command created is required or not.
Parameters:
newRequired - whether the next Command created is required or not.
Returns:
this CommandBuilder.