project35.soa.validation
Class RequiredFieldValidator
java.lang.Object
project35.soa.validation.AbstractEditFieldValidationService
project35.soa.validation.RequiredFieldValidator
- All Implemented Interfaces:
- java.io.Serializable, ServiceClass, EditFieldValidationService, FieldValidationService, ListFieldValidationService
public class RequiredFieldValidator
- extends AbstractEditFieldValidationService
- implements ListFieldValidationService
checks whether a required field has been left blank.
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
Method Summary |
protected boolean |
isFieldRequired()
returns whether the data field is required
return true if field is required; otherwise false |
void |
setRequiredField(boolean isFieldRequired)
sets whether the field is required or optional. |
void |
setScanForNone(boolean scanForNone)
|
java.util.ArrayList |
validate(Project35FormContext project35FormContext,
ListFieldModel listFieldModel)
validates the field value and returns any error messages |
java.util.ArrayList |
validate(Project35FormContext project35FormContext,
java.lang.String value)
checks to make sure that a required field has a non-empty value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RequiredFieldValidator
public RequiredFieldValidator()
isFieldRequired
protected boolean isFieldRequired()
- returns whether the data field is required
return true if field is required; otherwise false
- Overrides:
isFieldRequired
in class AbstractEditFieldValidationService
setScanForNone
public void setScanForNone(boolean scanForNone)
setRequiredField
public void setRequiredField(boolean isFieldRequired)
- sets whether the field is required or optional.
- Specified by:
setRequiredField
in interface FieldValidationService
- Overrides:
setRequiredField
in class AbstractEditFieldValidationService
- Parameters:
isFieldRequired
- true if the field is required; false if field is optional.
validate
public java.util.ArrayList validate(Project35FormContext project35FormContext,
java.lang.String value)
- checks to make sure that a required field has a non-empty value
- Specified by:
validate
in interface EditFieldValidationService
- Specified by:
validate
in class AbstractEditFieldValidationService
- Parameters:
value
- the value of the field
- Returns:
- an error message or null if there is no error
validate
public java.util.ArrayList validate(Project35FormContext project35FormContext,
ListFieldModel listFieldModel)
- Description copied from interface:
ListFieldValidationService
- validates the field value and returns any error messages
- Specified by:
validate
in interface ListFieldValidationService
listFieldModel
- the data object to be validated.
- Returns:
- an error message if the value is invalid or null
if no errors were found