org.opends.server.util.args
Class BooleanArgument

java.lang.Object
  extended by org.opends.server.util.args.Argument
      extended by org.opends.server.util.args.BooleanArgument

public class BooleanArgument
extends Argument

This class defines an argument type that will be used to represent Boolean values. These arguments will never take values from the command line but and will never be required. If the argument is provided, then it will be considered true, and if not then it will be considered false. As such, the default value will always be "false".


Constructor Summary
BooleanArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, Message description)
          Creates a new Boolean argument with the provided information.
 
Method Summary
 void addValue(java.lang.String valueString)
          Adds a value to the set of values for this argument.
 void setPresent(boolean isPresent)
          Specifies whether this argument is present in the parsed set of command-line arguments.
 boolean valueIsAcceptable(java.lang.String valueString, MessageBuilder invalidReason)
          Indicates whether the provided value is acceptable for use in this argument.
 
Methods inherited from class org.opends.server.util.args.Argument
clearValues, getBooleanValue, getDefaultValue, getDescription, getIntValue, getIntValues, getLongIdentifier, getName, getPropertyName, getShortIdentifier, getValue, getValuePlaceholder, getValues, hasValue, isHidden, isMultiValued, isPresent, isRequired, isValueSetByProperty, needsValue, setDefaultValue, setHidden, setMultiValued, setNeedsValue, setPropertyName, setRequired, setValuePlaceholder, setValueSetByProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanArgument

public BooleanArgument(java.lang.String name,
                       java.lang.Character shortIdentifier,
                       java.lang.String longIdentifier,
                       Message description)
                throws ArgumentException
Creates a new Boolean argument with the provided information.

Parameters:
name - The generic name that should be used to refer to this argument.
shortIdentifier - The single-character identifier for this argument, or null if there is none.
longIdentifier - The long identifier for this argument, or null if there is none.
description - Message for the description of this argument.
Throws:
ArgumentException - If there is a problem with any of the parameters used to create this argument.
Method Detail

valueIsAcceptable

public boolean valueIsAcceptable(java.lang.String valueString,
                                 MessageBuilder invalidReason)
Indicates whether the provided value is acceptable for use in this argument.

Specified by:
valueIsAcceptable in class Argument
Parameters:
valueString - The value for which to make the determination.
invalidReason - A buffer into which the invalid reason may be written if the value is not acceptable.
Returns:
true if the value is acceptable, or false if it is not.

addValue

public final void addValue(java.lang.String valueString)
Adds a value to the set of values for this argument. This should only be called if the value is allowed by the valueIsAcceptable method.

Overrides:
addValue in class Argument
Parameters:
valueString - The string representation of the value to add to this argument.

setPresent

public final void setPresent(boolean isPresent)
Specifies whether this argument is present in the parsed set of command-line arguments.

Overrides:
setPresent in class Argument
Parameters:
isPresent - Indicates whether this argument is present in the set of command-line arguments.