]
Hardy Ferentschik updated HV-292:
---------------------------------
Fix Version/s: (was: 4.1.0-Beta-1)
4.1.0
Provide a constraint annotation @ScriptAssert
---------------------------------------------
Key: HV-292
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-292
Project: Hibernate Validator
Issue Type: New Feature
Components: validators
Affects Versions: 4.1.0-Beta-1
Reporter: Gunnar Morling
Assignee: Gunnar Morling
Fix For: 4.1.0
Quite often the validation of one bean property depends on the value of another property
of the same bean. In such case a custom class-level constraint and a corresponding
validator have to be implemented.
This effort can be reduced by providing a generic class-level constraint, which allows to
evaluate arbitrary script expressions based on the annotated class as in the following
example:
@ScriptAssert(lang = "groovy", script =
"_this.startDate.before(_this.endDate)")
public class CalendarEvent {
private Date startDate;
private Date endDate;
//...
}
The blog post
http://musingsofaprogrammingaddict.blogspot.com/2009/08/script-annotation...
describes, how such a constraint could be realized using the JSR 223 ("Scripting for
the Java Platform") API.
In alternative to solely rely on JSR 223 it should be investigated, whether a more
general approach could be taken to enable the integration of scripting/expression
languages, for which no JSR 223 binding exists (e.g. Spring EL). This could be realized by
providing a SPI mechanism, which allows to plug-in additional script engine providers.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: