[hibernate-issues] [Hibernate-JIRA] Commented: (HV-38) Conditional validation

Bruno Braga (JIRA) noreply at atlassian.com
Sat Aug 18 13:59:13 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-38?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27884 ] 

Bruno Braga commented on HV-38:
-------------------------------

Already I created patch with Support Conditional Validation.

Example of use:
	public Boolean isReceiveNews() {
		return receiveNews;
	}
	@NotNull(applyIf="value.receiveNews == true")
	public String getAdress() {
		return adress;
	}
       @NotNull(applyIf="value.receiveNews == true")
	public String getTelephone() {
		return telephone;
	}
        ....

obs.:
The DefaultMessageInterpolator class, already created one annotationParameters (making loop in annotation). I used it to get the value of applyIf.
This is not most correct (for responsibility).
You can modify the name of DefaultMessageInterpolator and DefaultMessageInterpolatorAggerator or you suggest some refactoring.

A suggestion would be to consider one refactoring (extract the loop of annotation of the DefaultMessageInterpolator). If to change the name for DefaultParameterInterpolation, applyIf does not have interpolation..., but it is an option also.


> Conditional validation
> ----------------------
>
>                 Key: HV-38
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-38
>             Project: Hibernate Validator
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 3.0.0.ga
>            Reporter: Bruno Braga
>            Priority: Critical
>         Attachments: commons-jexl-1.1.jar, hibernate-validator.jar, patch.txt
>
>
> Support Conditional Validation
> Example:
> @NotNull(apply-if="some condition in el")
> I can develop this if you approve.

-- 
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

        



More information about the hibernate-issues mailing list