org.opends.server.util.args
Class StringArgument

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

public class StringArgument
extends Argument

This class defines an argument type that will accept any string value.


Constructor Summary
StringArgument(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, Message description)
          Creates a new string argument with the provided information.
StringArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean needsValue, Message valuePlaceholder, Message description)
          Creates a new string argument with the provided information.
 
Method Summary
 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

StringArgument

public StringArgument(java.lang.String name,
                      java.lang.Character shortIdentifier,
                      java.lang.String longIdentifier,
                      boolean isRequired,
                      boolean needsValue,
                      Message valuePlaceholder,
                      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.
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.

StringArgument

public StringArgument(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,
                      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.
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.