com.projectnine.csvmapper
Class CsvFieldValidator

java.lang.Object
  extended by com.projectnine.csvmapper.CsvFieldValidator
All Implemented Interfaces:
org.apache.commons.chain.Command
Direct Known Subclasses:
NoopCsvFieldValidator, NoSpecialCharacterCsvFieldValidator, PostalCodeCsvFieldValidator, RegularExpressionCsvFieldValidator

public abstract class CsvFieldValidator
extends java.lang.Object
implements org.apache.commons.chain.Command

A CsvFieldValidator may be used to validate that the value of a CSV field falls within certain parameters.

Author:
robweber

Field Summary
 
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
CsvFieldValidator()
           
 
Method Summary
protected abstract  boolean doValidate(CsvFieldValidationContext csvFieldValidationContext)
           
 boolean execute(org.apache.commons.chain.Context context)
          Child classes should invoke superexecute(Context) in order to access simple progress tracking of the Context through a Chain of CsvFieldValidators.
 void setRequired(boolean required)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvFieldValidator

public CsvFieldValidator()
Method Detail

execute

public final boolean execute(org.apache.commons.chain.Context context)
                      throws java.lang.Exception
Child classes should invoke superexecute(Context) in order to access simple progress tracking of the Context through a Chain of CsvFieldValidators. Return false to run the next command in the chain (if there is a next command); return true to stop execution with this command; throw an Exception when validation fails.

Specified by:
execute in interface org.apache.commons.chain.Command
Throws:
java.lang.Exception

doValidate

protected abstract boolean doValidate(CsvFieldValidationContext csvFieldValidationContext)
                               throws java.lang.Exception
Throws:
java.lang.Exception

setRequired

public void setRequired(boolean required)
Parameters:
required - the required to set


Copyright © 2008. All Rights Reserved.