org.opends.server.admin
Class DurationPropertyDefinition.Builder

java.lang.Object
  extended by org.opends.server.admin.PropertyDefinition.AbstractBuilder<java.lang.Long,DurationPropertyDefinition>
      extended by org.opends.server.admin.DurationPropertyDefinition.Builder
Enclosing class:
DurationPropertyDefinition

public static class DurationPropertyDefinition.Builder
extends PropertyDefinition.AbstractBuilder<java.lang.Long,DurationPropertyDefinition>

An interface for incrementally constructing duration property definitions.


Method Summary
protected  DurationPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?,?> d, java.lang.String propertyName, java.util.EnumSet<PropertyOption> options, AdministratorAction adminAction, DefaultBehaviorProvider<java.lang.Long> defaultBehavior)
          Build a property definition based on the properties of this builder.
 void setAllowUnlimited(boolean allowUnlimited)
          Specify whether or not this property definition will allow unlimited values (default is false).
 void setBaseUnit(DurationUnit unit)
          Set the base unit for this property definition (values including limits are specified in this unit).
 void setBaseUnit(java.lang.String unit)
          Set the base unit for this property definition (values including limits are specified in this unit).
 void setLowerLimit(long lowerLimit)
          Set the lower limit in milli-seconds.
 void setLowerLimit(java.lang.String lowerLimit)
          Set the lower limit using a string representation of the limit.
 void setMaximumUnit(DurationUnit unit)
          Set the maximum unit for this property definition.
 void setMaximumUnit(java.lang.String unit)
          Set the maximum unit for this property definition.
 void setUpperLimit(java.lang.Long upperLimit)
          Set the upper limit in milli-seconds.
 void setUpperLimit(java.lang.String upperLimit)
          Set the upper limit using a string representation of the limit.
 
Methods inherited from class org.opends.server.admin.PropertyDefinition.AbstractBuilder
getInstance, setAdministratorAction, setDefaultBehaviorProvider, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setBaseUnit

public final void setBaseUnit(java.lang.String unit)
                       throws java.lang.IllegalArgumentException
Set the base unit for this property definition (values including limits are specified in this unit). By default a duration property definition uses seconds.

Parameters:
unit - The string representation of the base unit (must not be null).
Throws:
java.lang.IllegalArgumentException - If the provided unit name did not correspond to a known duration unit, or if the base unit is bigger than the maximum unit.

setBaseUnit

public final void setBaseUnit(DurationUnit unit)
                       throws java.lang.IllegalArgumentException
Set the base unit for this property definition (values including limits are specified in this unit). By default a duration property definition uses seconds.

Parameters:
unit - The base unit (must not be null).
Throws:
java.lang.IllegalArgumentException - If the provided base unit is bigger than the maximum unit.

setMaximumUnit

public final void setMaximumUnit(java.lang.String unit)
                          throws java.lang.IllegalArgumentException
Set the maximum unit for this property definition. By default there is no maximum unit.

Parameters:
unit - The string representation of the maximum unit, or null if there should not be a maximum unit.
Throws:
java.lang.IllegalArgumentException - If the provided unit name did not correspond to a known duration unit, or if the maximum unit is smaller than the base unit.

setMaximumUnit

public final void setMaximumUnit(DurationUnit unit)
                          throws java.lang.IllegalArgumentException
Set the maximum unit for this property definition. By default there is no maximum unit.

Parameters:
unit - The maximum unit, or null if there should not be a maximum unit.
Throws:
java.lang.IllegalArgumentException - If the provided maximum unit is smaller than the base unit.

setLowerLimit

public final void setLowerLimit(long lowerLimit)
                         throws java.lang.IllegalArgumentException
Set the lower limit in milli-seconds.

Parameters:
lowerLimit - The new lower limit (must be >= 0) in milli-seconds.
Throws:
java.lang.IllegalArgumentException - If a negative lower limit was specified, or the lower limit is greater than the upper limit.

setLowerLimit

public final void setLowerLimit(java.lang.String lowerLimit)
                         throws java.lang.IllegalArgumentException
Set the lower limit using a string representation of the limit. If the string does not specify a unit, the current base unit will be used.

Parameters:
lowerLimit - The string representation of the new lower limit.
Throws:
java.lang.IllegalArgumentException - If the lower limit could not be parsed, or if a negative lower limit was specified, or the lower limit is greater than the upper limit.

setUpperLimit

public final void setUpperLimit(java.lang.Long upperLimit)
                         throws java.lang.IllegalArgumentException
Set the upper limit in milli-seconds.

Parameters:
upperLimit - The new upper limit in milli-seconds, or null if there is no upper limit.
Throws:
java.lang.IllegalArgumentException - If a negative upper limit was specified, or the lower limit is greater than the upper limit or unlimited durations are permitted.

setUpperLimit

public final void setUpperLimit(java.lang.String upperLimit)
                         throws java.lang.IllegalArgumentException
Set the upper limit using a string representation of the limit. If the string does not specify a unit, the current base unit will be used.

Parameters:
upperLimit - The string representation of the new upper limit, or null if there is no upper limit.
Throws:
java.lang.IllegalArgumentException - If the upper limit could not be parsed, or if the lower limit is greater than the upper limit.

setAllowUnlimited

public final void setAllowUnlimited(boolean allowUnlimited)
                             throws java.lang.IllegalArgumentException
Specify whether or not this property definition will allow unlimited values (default is false).

Parameters:
allowUnlimited - true if the property will allow unlimited values, or false otherwise.
Throws:
java.lang.IllegalArgumentException - If unlimited values are to be permitted but there is an upper limit specified.

buildInstance

protected DurationPropertyDefinition buildInstance(AbstractManagedObjectDefinition<?,?> d,
                                                   java.lang.String propertyName,
                                                   java.util.EnumSet<PropertyOption> options,
                                                   AdministratorAction adminAction,
                                                   DefaultBehaviorProvider<java.lang.Long> defaultBehavior)
Build a property definition based on the properties of this builder.

Specified by:
buildInstance in class PropertyDefinition.AbstractBuilder<java.lang.Long,DurationPropertyDefinition>
Parameters:
d - The managed object definition associated with this property definition.
propertyName - The property name.
options - Options applicable to this definition.
adminAction - The administrator action.
defaultBehavior - The default behavior provider.
Returns:
The new property definition.