iScreen 2.0.0: Reporting Validation Failures
Join the DZone community and get the full member experience.Join For Free
iScreen is a Java object validation framework, which means it is designed to validate full object-graphs. Based upon a powerful and flexible XML configuration, developers concentrate on configuring their validations, rather than coding them.
This new release adds several new features related to reporting validation failures. Failures can now have arbitrary severity levels, multiple failure messages, and a better tracing capability. A new conditional was added to individual validator use, which means that you can use logic to determine whether to execute a validator or not. Both OGNL and MVEL are supported expressions languages.
Here's an example of using the new 'if' attribute on the 'use-validator' element, and multiple messages associated with a failure (as well as defining a severity level on a failure).
<use-validator ref="MyStringValidator" if="bean. someProp != null" />
<validator id="MyStringValidator" ref="org.iscreen.StringValidator">
<failure property="minLengthFailure" key="minLengthMessage" severity="warning">
<msg name="action" key="minLengthActionMessage" />
<msg name="log_message" key="minLengthLogMessage" />
Opinions expressed by DZone contributors are their own.