Using Groovy for Validation
Groovy:
Is an agile and dynamic language for the Java Virtual Machine (JVM)
Builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby, and Smalltalk
Makes modern programming features available to Java developers with an almost zero learning curve
Supports Domain-Specific Languages (DSL) and other compact syntax, so your code becomes easy to read and maintain
Makes writing shell and build scripts easy with its powerful processing primitives, object-oriented (OO) abilities, and an Ant DSL
Increases developer productivity by reducing scaffolding code when developing Web, GUI, database, or console applications
Simplifies testing by supporting unit testing and mocking out of the box
Seamlessly integrates with all existing Java objects and libraries
Compiles straight to Java bytecode, so you can use it anywhere you use Java
Groovy expressions are Java-like scripting code stored in the XML definition of an entity object. Because Groovy expressions are stored in XML, you can change the expression values even if you do not have access to the entity object’s Java file. You can even change or specify values at run time. For more information, see http://groovy.codehaus.org.