views:

100

answers:

3

We have to validate a CSV file containing various configuration parameters. Are there any standard design patterns to do this type of validation.

More details:

  • There are different types of records - each with their own validation logic
  • Certain records cross reference other records
  • There are rules on the order of the records
  • There are rules on the eligibility of duplicate records
  • etc
A: 

The template pattern may help: http://en.wikipedia.org/wiki/Template_method_pattern

You set up a scaffolding for your validation in general terms, then hand off the algorithm to a delegate that knows how to handle specifics at various points.

darren
+2  A: 
sateesh
A: 

I know a friend of mine uses JBOSS DROOLS to validate this kind of files.

Pierre