org.deduced.validation.validator.rule
Class IsEnumerationValidRule

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

public class IsEnumerationValidRule
extends DeductionRuleLibrary

IsEnumerationValidRule validate if a reference to an enumeration type uses the correct types and avoids invalid enumeration values.

Author:
Steve McDuff

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deduced.rule.DeductionRuleLibrary
DeductionRuleLibrary.CompareResult
 
Constructor Summary
IsEnumerationValidRule()
           
 
Method Summary
 java.lang.Object analyzeRule(java.lang.Object[] inputs, RuleExecutionContext context, PropertyCollection collection, PropertyCollection rule)
          (non-Javadoc)
static java.lang.String validateEnumeration(java.lang.Object value, java.util.List<?> enumerationValues, java.util.List<?> invalidValues, java.lang.Boolean isNullValid, PropertyCollection<?,?> enumerationType)
          validate if a type to reference is valid
 
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

IsEnumerationValidRule

public IsEnumerationValidRule()
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)

validateEnumeration

public static java.lang.String validateEnumeration(java.lang.Object value,
                                                   java.util.List<?> enumerationValues,
                                                   java.util.List<?> invalidValues,
                                                   java.lang.Boolean isNullValid,
                                                   PropertyCollection<?,?> enumerationType)
validate if a type to reference is valid

Parameters:
value - the value to reference
enumerationValues - the enumeration values that are currently valid
invalidValues - the list of values that are considered invalid.
isNullValid - flag indicating if the reference is allowed to be null.
enumerationType - the enumeration type being validated
Returns:
an error string based on the validation error. If the new type is valid, a null string is returned.