com.cafesoft.core.field
Class IntegerValidationRule

java.lang.Object
  |
  +--com.cafesoft.core.field.DefaultFieldValidationRule
        |
        +--com.cafesoft.core.field.IntegerValidationRule
All Implemented Interfaces:
FieldValidationRule

public class IntegerValidationRule
extends DefaultFieldValidationRule

IntegerValidationRule validates all Integer FieldType field values to ensure that the value conform to the rules of the field.

Since:
8/12/03
See Also:
DefaultFieldValidationRule, FieldValidationRule

Field Summary
 
Fields inherited from class com.cafesoft.core.field.DefaultFieldValidationRule
fieldInfo
 
Constructor Summary
IntegerValidationRule(FieldInfo fieldInfo)
          Create a new IntegerValidationRule.
 
Method Summary
 void validate(Object fieldValue)
          Assert validity of a Field value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerValidationRule

public IntegerValidationRule(FieldInfo fieldInfo)
Create a new IntegerValidationRule.

Parameters:
fieldInfo - field level metadata object.
Throws:
NullPointerException - if fieldInfo is null.
Method Detail

validate

public void validate(Object fieldValue)
              throws InvalidFieldValueException
Assert validity of a Field value.

The IntegerValidationRule will validate a fieldValue under the following conditions:

  1. If the fieldValue equals null and null is an allowed fieldValue the fieldValue is valid, otherwise null is not allowed and the fieldValue is invalid.
  2. If the fieldValue is the wildcard character "*", and no FieldValueOptions class has been defined for the FieldInfo object. Then the fieldValue pattern of "*" is valid. However if a FieldValueOptions class has been defined and the class does not contain "*" the fieldValue pattern is invalid.
  3. If the fieldValue is of type String and does not equal the wildcard character, and the fieldValue object does not parse into a valid integer value the fieldValue pattern is invalid.
  4. If the fieldValue is not of type String or Integer the fieldValue pattern is invalid.
  5. If the FieldInfo object contains a FieldValueOptions class, that class must contain the Integer value. If it does not the FieldValue pattern is invalid.
  6. If the FieldInfo object contains a minimum value the integer value must be equal to or greater than that minimum value. If it is not then the fieldValue pattern is invalid.
  7. If the FieldInfo object contains a maximum value the integer value must be equal to or less than that maximum value. If it is not then the fieldValue pattern is invalid.
  8. If all of these questions have been passed the pattern is valid.

Specified by:
validate in interface FieldValidationRule
Overrides:
validate in class DefaultFieldValidationRule
Throws:
InvalidFieldValueException - if the Field value in invalid.


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.