org.opends.server.util.args
Class IntegerArgument

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

public class IntegerArgument
extends Argument

This class defines an argument type that will only accept integer values, and potentially only those in a given range.


Constructor Summary
IntegerArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean isMultiValued, boolean needsValue, Message valuePlaceholder, int defaultValue, java.lang.String propertyName, boolean hasLowerBound, int lowerBound, boolean hasUpperBound, int upperBound, Message description)
          Creates a new integer argument with the provided information.
IntegerArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean isMultiValued, boolean needsValue, Message valuePlaceholder, int defaultValue, java.lang.String propertyName, Message description)
          Creates a new integer argument with the provided information.
IntegerArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean needsValue, Message valuePlaceholder, boolean hasLowerBound, int lowerBound, boolean hasUpperBound, int upperBound, Message description)
          Creates a new integer argument with the provided information.
IntegerArgument(java.lang.String name, java.lang.Character shortIdentifier, java.lang.String longIdentifier, boolean isRequired, boolean needsValue, Message valuePlaceholder, Message description)
          Creates a new integer argument with the provided information.
 
Method Summary
 int getLowerBound()
          Retrieves the lower bound that may be enforced for values of this argument.
 int getUpperBound()
          Retrieves the upper bound that may be enforced for values of this argument.
 boolean hasLowerBound()
          Indicates whether a lower bound should be enforced for values of this argument.
 boolean hasUpperBound()
          Indicates whether a upper bound should be enforced for values of this argument.
 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

IntegerArgument

public IntegerArgument(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 integer 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.

IntegerArgument

public IntegerArgument(java.lang.String name,
                       java.lang.Character shortIdentifier,
                       java.lang.String longIdentifier,
                       boolean isRequired,
                       boolean needsValue,
                       Message valuePlaceholder,
                       boolean hasLowerBound,
                       int lowerBound,
                       boolean hasUpperBound,
                       int upperBound,
                       Message description)
                throws ArgumentException
Creates a new integer 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.
hasLowerBound - Indicates whether a lower bound should be enforced for values of this argument.
lowerBound - The lower bound that should be enforced for values of this argument.
hasUpperBound - Indicates whether an upperbound should be enforced for values of this argument.
upperBound - The upper bound that should be enforced for values of this 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.

IntegerArgument

public IntegerArgument(java.lang.String name,
                       java.lang.Character shortIdentifier,
                       java.lang.String longIdentifier,
                       boolean isRequired,
                       boolean isMultiValued,
                       boolean needsValue,
                       Message valuePlaceholder,
                       int defaultValue,
                       java.lang.String propertyName,
                       Message description)
                throws ArgumentException
Creates a new integer 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.

IntegerArgument

public IntegerArgument(java.lang.String name,
                       java.lang.Character shortIdentifier,
                       java.lang.String longIdentifier,
                       boolean isRequired,
                       boolean isMultiValued,
                       boolean needsValue,
                       Message valuePlaceholder,
                       int defaultValue,
                       java.lang.String propertyName,
                       boolean hasLowerBound,
                       int lowerBound,
                       boolean hasUpperBound,
                       int upperBound,
                       Message description)
                throws ArgumentException
Creates a new integer 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.
hasLowerBound - Indicates whether a lower bound should be enforced for values of this argument.
lowerBound - The lower bound that should be enforced for values of this argument.
hasUpperBound - Indicates whether an upperbound should be enforced for values of this argument.
upperBound - The upper bound that should be enforced for values of this 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

hasLowerBound

public boolean hasLowerBound()
Indicates whether a lower bound should be enforced for values of this argument.

Returns:
true if a lower bound should be enforced for values of this argument, or false if not.

getLowerBound

public int getLowerBound()
Retrieves the lower bound that may be enforced for values of this argument.

Returns:
The lower bound that may be enforced for values of this argument.

hasUpperBound

public boolean hasUpperBound()
Indicates whether a upper bound should be enforced for values of this argument.

Returns:
true if a upper bound should be enforced for values of this argument, or false if not.

getUpperBound

public int getUpperBound()
Retrieves the upper bound that may be enforced for values of this argument.

Returns:
The upper bound that may be enforced for values of this argument.

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.