project35.soa.validation
Class BoundedIntegerValidator

java.lang.Object
  extended by project35.soa.validation.AbstractEditFieldValidationService
      extended by project35.soa.validation.NumericValidator
          extended by project35.soa.validation.IntegerValidator
              extended by project35.soa.validation.BoundedIntegerValidator
All Implemented Interfaces:
java.io.Serializable, ServiceClass, ConstraintDescription, EditFieldValidationService, FieldValidationService

public class BoundedIntegerValidator
extends IntegerValidator
implements ConstraintDescription

Determines whether an integer field value is within minimum and maximum bounds boundaries are inclusive. The validator accepts four types of domain expression. Examples include:


Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class project35.soa.validation.AbstractEditFieldValidationService
collator
 
Constructor Summary
BoundedIntegerValidator()
          constructor
 
Method Summary
 java.lang.String getConstraintsDescription()
           
 void setBounds(int lowerBound, boolean lowerBoundIsInclusive, int upperBound, boolean upperBoundIsInclusive)
          sets lower and upper bounds
 void setLowerBound(int lowerBound, boolean lowerBoundIsInclusive)
          sets lower bounds
 void setUpperBound(int upperBound, boolean upperBoundIsInclusive)
          sets upper bounds
 java.util.ArrayList validate(Project35FormContext project35FormContext, java.lang.String value)
          validates a field value
 
Methods inherited from class project35.soa.validation.AbstractEditFieldValidationService
getFieldName, getInitialisationParameters, initialiseService, isEmpty, isFieldRequired, setFieldName, setRequiredField, validateRequiredField
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedIntegerValidator

public BoundedIntegerValidator()
constructor

Method Detail

getConstraintsDescription

public java.lang.String getConstraintsDescription()
Specified by:
getConstraintsDescription in interface ConstraintDescription

setBounds

public void setBounds(int lowerBound,
                      boolean lowerBoundIsInclusive,
                      int upperBound,
                      boolean upperBoundIsInclusive)
sets lower and upper bounds

Parameters:
lowerBound - the lower bound value
lowerBoundIsInclusive - whether lower bound is inclusive or exlusive
upperBound - the upper bound value
upperBoundIsInclusive - whether upper bound is inclusive or exlusive

setLowerBound

public void setLowerBound(int lowerBound,
                          boolean lowerBoundIsInclusive)
sets lower bounds

Parameters:
lowerBound - the lower bound value
lowerBoundIsInclusive - whether lower bound is inclusive or exlusive

setUpperBound

public void setUpperBound(int upperBound,
                          boolean upperBoundIsInclusive)
sets upper bounds

Parameters:
upperBound - the upper bound value
upperBoundIsInclusive - whether upper bound is inclusive or exlusive

validate

public java.util.ArrayList validate(Project35FormContext project35FormContext,
                                    java.lang.String value)
validates a field value

Specified by:
validate in interface EditFieldValidationService
Overrides:
validate in class IntegerValidator
Parameters:
project35FormContext - contains references to various application features
value - the field value
Returns:
error message or empty string null if no errors were found