Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Issues List »

[hibernate-issues] [Hibernate-JIRA] Created: (HV-292) Provide a
constraint annotation @ScriptAssert

Anupam M (JIRA)

2010-03-11

Replies: Find Java Web Hosting

Author LoginPost Reply
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: Hardy Ferentschik


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-for-bean-validation.html 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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

   
_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues
©2008 gg3721.com - Jax Systems, LLC, U.S.A.