Example XML Rules document:
<user>
<username>
<not-null/>
<capitals value="false"/>
<max-length value="15"/>
</username>
<email>
<not-null/>
<isEmail/>
<max-length value="40"/>
</email>
</user>
How do I implement this? I'm starting from scratch, what I currently have is a User-class, and a UserController which saves the User object in de DB (through a Service-layer and Dao-layer), basic Spring MVC. I can't use Spring MVC Validation however in our Model-classes, I have to use an XML document so an Admin can change the rules
I think I need a pattern which dynamically builds an algorithm based on what is provided by the XML Rules document, but I can't seem to think of anything other than a massive amount of if-statements.
I also have nothing for the parsing yet and I'm not sure how I'm gonna (de)couple it from the actual implementation of the validation-process.