org.opends.server.util.args
Class MultiChoiceArgument

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

public class MultiChoiceArgument
extends Argument

This class defines an argument type that will only accept one or more of a specific set of string values.


Constructor Summary
MultiChoiceArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean isMultiValued, boolean needsValue, Message valuePlaceholder, java.lang.String defaultValue, java.lang.String propertyName, java.util.HashSet<java.lang.String> allowedValues, boolean caseSensitive, Message description)
          Creates a new string argument with the provided information.
MultiChoiceArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean needsValue, Message valuePlaceholder, java.util.HashSet<java.lang.String> allowedValues, boolean caseSensitive, Message description)
          Creates a new string argument with the provided information.
 
Method Summary
 java.util.HashSet<java.lang.String> getAllowedValues()
          Retrieves the set of allowed values for this argument.
 boolean isCaseSensitive()
          Indicates whether the set of allowed values for this argument should be treated in a case-sensitive manner.
 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
addValue, clearValues, getBooleanValue, getDefaultValue, getDescription, getIntValue, getIntValues, getLongIdentifier, getName, getPropertyName, getShortIdentifier, getValue, getValuePlaceholder, getValues, hasValue, isHidden, isMultiValued, isPresent, isRequired, isValueSetByProperty, needsValue, setDefaultValue, setHidden, setMultiValued, setNeedsValue, setPresent, setPropertyName, setRequired, setValuePlaceholder, setValueSetByProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiChoiceArgument

public MultiChoiceArgument(java.lang.String name,
                           java.lang.Character shortIdentifier,
                           java.lang.String longIdentifier,
                           boolean isRequired,
                           boolean needsValue,
                           Message valuePlaceholder,
                           java.util.HashSet<java.lang.String> allowedValues,
                           boolean caseSensitive,
                           Message description)
                    throws ArgumentException
Creates a new string 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.
isRequired - Indicates whether this argument must be specified on the command line.
needsValue - Indicates whether this argument requires a value.
valuePlaceholder - The placeholder for the argument value that will be displayed in usage information, or null if this argument does not require a value.
allowedValues - The set of values that are allowed for use for this argument. If they are not to be treated in a case-sensitive value then they should all be formatted in lowercase.
caseSensitive - Indicates whether the set of allowed values should be treated in a case-sensitive manner.
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.

MultiChoiceArgument

public MultiChoiceArgument(java.lang.String name,
                           java.lang.Character shortIdentifier,
                           java.lang.String longIdentifier,
                           boolean isRequired,
                           boolean isMultiValued,
                           boolean needsValue,
                           Message valuePlaceholder,
                           java.lang.String defaultValue,
                           java.lang.String propertyName,
                           java.util.HashSet<java.lang.String> allowedValues,
                           boolean caseSensitive,
                           Message description)
                    throws ArgumentException
Creates a new string 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.
isRequired - Indicates whether this argument must be specified on the command line.
isMultiValued - Indicates whether this argument may be specified more than once to provide multiple values.
needsValue - Indicates whether this argument requires a value.
valuePlaceholder - The placeholder for the argument value that will be displayed in usage information, or null if this argument does not require a value.
defaultValue - The default value that should be used for this argument if none is provided in a properties file or on the command line. This may be null if there is no generic default.
propertyName - The name of the property in a property file that may be used to override the default value but will be overridden by a command-line argument.
allowedValues - The set of values that are allowed for use for this argument. If they are not to be treated in a case-sensitive value then they should all be formatted in lowercase.
caseSensitive - Indicates whether the set of allowed values should be treated in a case-sensitive manner.
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

getAllowedValues

public java.util.HashSet<java.lang.String> getAllowedValues()
Retrieves the set of allowed values for this argument. The contents of this set must not be altered by the caller.

Returns:
The set of allowed values for this argument.

isCaseSensitive

public boolean isCaseSensitive()
Indicates whether the set of allowed values for this argument should be treated in a case-sensitive manner.

Returns:
true if the values are to be treated in a case-sensitive manner, or false if not.

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.