|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.validation.AbstractValidator<T>
public abstract class AbstractValidator<T>
Partial implementation of a Validator
.
Version Info:
$Revision: 1511 $ |
$Date: 2008-08-19 11:43:17 -0600 (Tue, 19 Aug 2008) $ |
$Author: dharland $ |
Field Summary | |
---|---|
protected boolean |
failFast
When true, validate() stops running tests after first failure. |
protected List<ValidationFailure> |
failures
List of all validation failures. |
protected ValidationManager |
manager
The manager for which this validator is performing its duties. |
protected ValidationPurpose |
purpose
The purpose for which this validator was most recently run. |
protected T |
target
The object most recently subject to validation by this validator. |
Constructor Summary | |
---|---|
protected |
AbstractValidator(String validatorName,
Class<? extends T> targetClass)
Helps create a new instance. |
Method Summary | |
---|---|
String |
getName()
Returns the name of this validator. |
ValidationPurpose |
getPurpose()
Returns the purpose for which this validator was most recently run. |
T |
getTarget()
Returns the object most recently subject to validation by this validator. |
protected abstract List<Validation<T>> |
makeValidationList(ValidationPurpose purpose)
Creates and returns a list of validations to be performed for the given purpose . |
void |
setManager(ValidationManager newManager)
Sets the manager for which this validator is performing its duties. |
void |
stopTestingAfterFirstFailure(boolean stop)
Tells this validator whether it should run all validations or stop after the first validation that fails. |
protected void |
validate()
Runs each of the individual validations. |
List<ValidationFailure> |
validate(Object target,
ValidationPurpose purpose)
Validates target for use for the given purpose . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected T target
protected ValidationPurpose purpose
protected List<ValidationFailure> failures
protected ValidationManager manager
protected boolean failFast
Constructor Detail |
---|
protected AbstractValidator(String validatorName, Class<? extends T> targetClass)
Method Detail |
---|
public String getName()
Validator
getName
in interface Validator
public T getTarget()
Validator
getTarget
in interface Validator
public ValidationPurpose getPurpose()
Validator
getPurpose
in interface Validator
public void setManager(ValidationManager newManager)
Validator
newManager
.
The main use made by this validator of its manager is to request validators for the component objects held by the target object of this validator.
setManager
in interface Validator
newManager
- the manager for which this validator is performing
its duties.public void stopTestingAfterFirstFailure(boolean stop)
stopTestingAfterFirstFailure
in interface Validator
stop
- if true this validator will stop running its
validations after the first one fails.public List<ValidationFailure> validate(Object target, ValidationPurpose purpose)
Validator
target
for use for the given purpose
.
validate
in interface Validator
target
- the object to be validated.purpose
- the reason for the validation.
protected void validate()
Subclasses may use this default implementation or override it.
Subclasses that contain collections of component objects will typically
override this method, call super.validate()
, and then invoke
other validators on the elements of the collections.
protected abstract List<Validation<T>> makeValidationList(ValidationPurpose purpose)
purpose
.
purpose
- the reason for which a validation is performed.
purpose
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |