wood burning stoves 2.0
The moose likes OO, Patterns, UML and Refactoring and the fly likes what pattern is this.....? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "what pattern is this.....?" Watch "what pattern is this.....?" New topic

what pattern is this.....?

Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
I am not sure what to call this pattern-could someone help- For our validation on Objects-We are using standard java beans(not ejb's) that "set" the data, before the actual Access Bean is used to create,update,or delete the EJB. The problem was that we had "lots" of data to validate, and were looking for a way to validate it more "dynamically."
Each java bean(not ejb) has a "validator" class which basically has all of the valiation logic. Each method in the validator class can but does not always map over to the java bean getter methods. Somae validation values are loaded into the validator class via properties files(not the best design). Due to the significant number of fields in the java bean, we used the reflection api to dynamically validate all of the fields by calling the getMethods of the java bean class against the getMethods of the validator class. If the two match(with some string manipulation), we call getvalue on the java bean method and the corresponding validate method that checks the value. The result is that when we add validation methods to the validator class, there are no changes outside of that class(ie I don't have to code for it elsewhere). Also, methods that we don't want validated, we simply don't add to the validator class.
Is this even a pattern? Does this resemble any existing patterns?
Thomas Smets
Ranch Hand

Joined: Dec 11, 2001
Posts: 111
Give a look at JUnit's web site ! JUnit in itself is not what you ask for I believe but there is plenty of extensions which you could use for your problem !
Could you post your findings about yr problem on the site or directly ot me ?

Thomas Smets
Just another developper
I agree. Here's the link: http://aspose.com/file-tools
subject: what pattern is this.....?
It's not a secret anymore!