org.deduced.validation.validator.rule
Class IsNumberValidRule

java.lang.Object
  extended by org.deduced.rule.DeductionRuleLibrary
      extended by org.deduced.validation.validator.rule.IsNumberValidRule
All Implemented Interfaces:
DeductionRuleAnalyzer<java.lang.Object>

public class IsNumberValidRule
extends DeductionRuleLibrary

IsNumberValidRule is used to validate numbers between a minimum, maximum value. It also validates if the number is allowed to be null.

Author:
Steve McDuff

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deduced.rule.DeductionRuleLibrary
DeductionRuleLibrary.CompareResult
 
Constructor Summary
IsNumberValidRule()
           
 
Method Summary
 java.lang.Object analyzeRule(java.lang.Object[] inputs, RuleExecutionContext context, PropertyCollection collection, PropertyCollection rule)
          (non-Javadoc)
static java.lang.String validateNumber(java.lang.Object value, java.lang.Number min, java.lang.Number max, java.lang.Boolean canBeNull)
          validate that a number is within boundaries.
 
Methods inherited from class org.deduced.rule.DeductionRuleLibrary
addReferenceToList, and, bigger, biggerOrEqual, clearPropertyCollection, createDateIncrementList, createObject, createObjectsMatchingAllValues, createObjectsMatchingAllValues, createObjectsMatchingAllValuesInOrderedList, createObjectsMatchingAllValuesInOrderedList, createOrReuseListToMatchType, debug, equals, equalTo, fillList, fillListWithSpecifiedTypes, fillOrderedList, fillOrderedListExtractMatchesValues, fillOrderedListWithSpecifiedTypes, filter, filterList, filterList, filterList, findParentOfType, formatDate, formatDate, formatTime, getModelFromCollection, getPropertyCollectionController, instanceOf, maximumCollection, maximumValue, merge, minimumCollection, minimumValue, not, or, property, removeAlreadyMatchedOrderedListValues, same, smaller, smallerOrEqual, sum, sum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IsNumberValidRule

public IsNumberValidRule()
Method Detail

analyzeRule

public java.lang.Object analyzeRule(java.lang.Object[] inputs,
                                    RuleExecutionContext context,
                                    PropertyCollection collection,
                                    PropertyCollection rule)
(non-Javadoc)

Parameters:
inputs - the array of inputs
context - the rule execution context
collection - the collection on which the rule is executed
rule - the rule being executed
Returns:
the rule result
See Also:
DeductionRuleAnalyzer.analyzeRule(java.lang.Object[], org.deduced.RuleExecutionContext, org.deduced.PropertyCollection, org.deduced.PropertyCollection)

validateNumber

public static java.lang.String validateNumber(java.lang.Object value,
                                              java.lang.Number min,
                                              java.lang.Number max,
                                              java.lang.Boolean canBeNull)
validate that a number is within boundaries. Also validate if the number is allowed to be null.

Parameters:
value - the numeric value
min - the minimum value the number must match. If this parameter is null, then the number can have any minimum value.
max - the maximum value the number must match. If this parameter is null, then the number can have any maximum value.
canBeNull - flag indicating if the object can be null. If the flag is null, then the object is allowed to be null.
Returns:
the validation error string. Null if the new value is valid.