]
Diego Pires Plentz updated HV-18:
---------------------------------
Component/s: validators
Request for Expression Language (EL) for Validator annotations
--------------------------------------------------------------
Key: HV-18
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-18
Project: Hibernate Validator
Issue Type: New Feature
Components: validators
Environment: All
Reporter: Chris Hansen
Original Estimate: 8 weeks
Remaining Estimate: 8 weeks
Since annotations are limited to primitive types, I would like to see a type of EL for
the Validator annotations (similar to the JSF/JSP EL). This would effectively overcome
this limitation of annotations and allow for very powerful functionality, such as
utilizing the natural ordering of classes. For example:
@Range(min="#{MyClass.MIN_OBJECT}", max="#{MyClass.MAX_OBJECT}")
public MyClass getCurrent()
Assuming MIN_OBJECT and MAX_OBJECT are (static, final) instances of MyClass and MyClass
implements Comparable<myClass>, the validator could compare the return value of the
method with both MIN_OBJECT and MAX_OBJECT and validate that it is within the desired
range.
This is just an example. I'm sure there are many more interesting uses possible
because this is a powerful concept.
The regular functionality of the annotatinos could be preserved by treating static
(non-EL) values, such as the string "0", as old-style primitives, e.g.
@Min(value="0").
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: