net.dpml.cli.builder
Class ArgumentBuilder
java.lang.Object
net.dpml.cli.builder.ArgumentBuilder
Builds Argument instances.
ArgumentBuilder
public ArgumentBuilder()
Creates a new ArgumentBuilder instance
create
public final Argument create()
Creates a new Argument instance using the options specified in this
ArgumentBuilder.
- A new Argument instance using the options specified in this
ArgumentBuilder.
reset
public final ArgumentBuilder reset()
Resets the ArgumentBuilder to the defaults for a new Argument. The
method is called automatically at the end of a create() call.
withConsumeRemaining
public final ArgumentBuilder withConsumeRemaining(String newConsumeRemaining)
Sets the "consume remaining" option, defaults to "--". Use this if you
want to allow values that might be confused with option strings.
newConsumeRemaining
- the string to use for the consume
remaining option
withDefault
public final ArgumentBuilder withDefault(Object defaultValue)
Sets the default value.
defaultValue
- the default value for the Argument
withDefaults
public final ArgumentBuilder withDefaults(List newDefaultValues)
Sets the default values.
newDefaultValues
- the default values for the Argument
withDescription
public final ArgumentBuilder withDescription(String newDescription)
Sets the description of the argument.
The description is used when displaying online help.
newDescription
- a description of the argument
withInitialSeparator
public final ArgumentBuilder withInitialSeparator(char newInitialSeparator)
Sets the character used to separate the values from the option. When an
argument is of the form -libs:dir1,dir2,dir3 the initialSeparator would
be ':'.
newInitialSeparator
- the character used to separate the values
from the option
withMaximum
public final ArgumentBuilder withMaximum(int newMaximum)
Sets the maximum number of values allowed for the argument to be valid.
newMaximum
- the number of values allowed
withMinimum
public final ArgumentBuilder withMinimum(int newMinimum)
Sets the minimum number of values needed for the argument to be valid.
newMinimum
- the number of values needed
withName
public final ArgumentBuilder withName(String newName)
Sets the name of the argument. The name is used when displaying usage
information and to allow lookups in the CommandLine object.
newName
- the name of the argument
withSubsequentSeparator
public final ArgumentBuilder withSubsequentSeparator(char newSubsequentSeparator)
Sets the character used to separate the values from each other. When an
argument is of the form -libs:dir1,dir2,dir3 the subsequentSeparator
would be ','.
newSubsequentSeparator
- the character used to separate the values
from each other
withValidator
public final ArgumentBuilder withValidator(Validator newValidator)
Sets the validator instance used to perform validation on the Argument
values.
newValidator
- a Validator instance