public abstract class AbstractValidator<T> extends Object implements Validator<T>
Validator interface. This class
supplies a default implementations for listener registration, so that concrete implementations need only call fireErrorItemEvent(org.mged.magetab.error.ErrorItem) to report an event whenever an error item is generated.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractValidator() |
| Modifier and Type | Method and Description |
|---|---|
void |
addErrorItemListener(ErrorItemListener listener)
Register an
ErrorItemListener with this parser. |
void |
addProgressListener(ProgressListener listener)
Register a
ProgressListener with this validator. |
protected void |
fireErrorItemEvent(org.mged.magetab.error.ErrorItem errorItem)
Fires an error item notification on any
ErrorItemListeners currently configured to listen to this
validator. |
protected void |
fireValidationCompletedEvent(ProgressEvent event) |
protected void |
fireValidationEvent(ProgressEvent event) |
protected void |
fireValidationFailedEvent(ProgressEvent event) |
protected void |
fireValidationStartedEvent(ProgressEvent event) |
Set<ErrorItemListener> |
getErrorItemListeners()
Get the current set of
ErrorItemListeners registered to this
validator |
org.slf4j.Logger |
getLog() |
Collection<ProgressListener> |
getProgressListeners()
Get the collection of
ProgressListeners that are currently registered to this validator. |
void |
removeErrorItemListener(ErrorItemListener listener)
Deregister an
ErrorItemListener with this parser. |
void |
removeProgressListener(ProgressListener listener)
Deregister a
ProgressListener from this validator. |
void |
validate(T validatorSource,
ExecutorService service)
This default implementation ignored the supplied service and executes tasks in a linear manner, This is retained
to preserve backwards compatibility with the 1.0 release.
|
public org.slf4j.Logger getLog()
public void addErrorItemListener(ErrorItemListener listener)
ValidatorErrorItemListener with this parser. Whenever an error is encountered when parsing from the a
parserSource, this listener should be notified.addErrorItemListener in interface Validator<T>listener - the listener to registerpublic void removeErrorItemListener(ErrorItemListener listener)
ValidatorErrorItemListener with this parser. This listener will no longer be notified when error
items are generated.removeErrorItemListener in interface Validator<T>listener - the listener to registerpublic Set<ErrorItemListener> getErrorItemListeners()
ValidatorErrorItemListeners registered to this
validatorgetErrorItemListeners in interface Validator<T>public void addProgressListener(ProgressListener listener)
ValidatorProgressListener with this validator. Whenever the validator has more progress to report, this
listener will be notified.addProgressListener in interface Validator<T>listener - the listener to registerpublic void removeProgressListener(ProgressListener listener)
ValidatorProgressListener from this validator. Progress events will no longer be reported through this
validatorremoveProgressListener in interface Validator<T>listener - a listener to monitor progress of the parsing operationpublic Collection<ProgressListener> getProgressListeners()
ValidatorProgressListeners that are currently registered to this validator.getProgressListeners in interface Validator<T>public void validate(T validatorSource, ExecutorService service) throws ValidateException, InterruptedException
validate in interface Validator<T>validatorSource - the datamodel objects to validateservice - the service to use to execute validation tasksValidateExceptionInterruptedExceptionprotected void fireErrorItemEvent(org.mged.magetab.error.ErrorItem errorItem)
ErrorItemListeners currently configured to listen to this
validator.errorItem - the error item that encapsulates the errorprotected void fireValidationStartedEvent(ProgressEvent event)
protected void fireValidationCompletedEvent(ProgressEvent event)
protected void fireValidationFailedEvent(ProgressEvent event)
protected void fireValidationEvent(ProgressEvent event)
Copyright © 2014. All rights reserved.