This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "what pattern is this.....?" Watch "what pattern is this.....?" New topic
Author

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
Matt,
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: what pattern is this.....?
 
Similar Threads
ValidatorActionForm Question?
long post IBM.158
struts validate() question
Passed SCEA Part 2 - My experience
Retrieving an element when we only know what the id starts with