org.deduced.validation.validator.rule
Class IsNumberValidRule
java.lang.Object
org.deduced.rule.DeductionRuleLibrary
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
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 |
IsNumberValidRule
public IsNumberValidRule()
analyzeRule
public java.lang.Object analyzeRule(java.lang.Object[] inputs,
RuleExecutionContext context,
PropertyCollection collection,
PropertyCollection rule)
- (non-Javadoc)
- Parameters:
inputs
- the array of inputscontext
- the rule execution contextcollection
- the collection on which the rule is executedrule
- 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 valuemin
- 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.