org.alfresco.repo.dictionary.constraint
Class NumericRangeConstraint

java.lang.Object
  extended by org.alfresco.repo.dictionary.constraint.AbstractConstraint
      extended by org.alfresco.repo.dictionary.constraint.NumericRangeConstraint
All Implemented Interfaces:
Constraint

public class NumericRangeConstraint
extends AbstractConstraint

Constraint implementation that ensures that the value is a numeric value bewteen a given minimum and maximum value. If a minimum or maximum value are not provided, then the JAVA Double's minimum value or maximum value are assumed.

See Also:
NumericRangeConstraint.setMinValue(double), NumericRangeConstraint.setMaxValue(double), Double.parseDouble(java.lang.String)

Field Summary
 
Fields inherited from class org.alfresco.repo.dictionary.constraint.AbstractConstraint
ERR_EVALUATE_EXCEPTION, ERR_PROP_NOT_SET
 
Constructor Summary
NumericRangeConstraint()
           
 
Method Summary
protected  void evaluateSingleValue(java.lang.Object value)
          Support for evaluation of properties.
 double getMaxValue()
           
 double getMinValue()
           
 void initialize()
          Initializes the constraint with appropriate values, which will depend on the implementation itself.
 void setMaxValue(double maxValue)
          Set the maximum value allowed, which can be any value between Double.MIN_VALUE and Double.MAX_VALUE.
 void setMinValue(double minValue)
          Set the minimum value allowed, which can be any value between Double.MIN_VALUE and Double.MAX_VALUE.
 java.lang.String toString()
           
 
Methods inherited from class org.alfresco.repo.dictionary.constraint.AbstractConstraint
checkPropertyNotNull, evaluate, evaluateCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumericRangeConstraint

public NumericRangeConstraint()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMinValue

public double getMinValue()
Returns:
Returns the minimum value allowed by the constraint

setMinValue

public void setMinValue(double minValue)
Set the minimum value allowed, which can be any value between Double.MIN_VALUE and Double.MAX_VALUE.

Parameters:
minValue - the minimum value allowed by the constraint

getMaxValue

public double getMaxValue()
Returns:
Returns the minimum value allowed by the constraint

setMaxValue

public void setMaxValue(double maxValue)
Set the maximum value allowed, which can be any value between Double.MIN_VALUE and Double.MAX_VALUE.

Parameters:
maxValue - the minimum value allowed by the constraint

initialize

public void initialize()
Description copied from interface: Constraint
Initializes the constraint with appropriate values, which will depend on the implementation itself. This method can be implemented as a once-off, i.e. reinitialization does not have to be supported.


evaluateSingleValue

protected void evaluateSingleValue(java.lang.Object value)
Description copied from class: AbstractConstraint
Support for evaluation of properties. The value passed in will never be a Collection and will never be null.

Specified by:
evaluateSingleValue in class AbstractConstraint


Copyright © 2005 - 2008 Alfresco Software, Inc. All Rights Reserved.