Change By: Gunnar Morling (23/Feb/13 12:00 PM)
Description: {{@ScriptAssert}} should be allowed to be used as cross-parameter constraint. 

We could also provide a dedicated constraint which makes the intention clearer and e.g. uses {{args}} as alias:

{code}
@ParametersAssert(script="args[0] == args[1]", lang="javascript")
public void resetPassword(String password, String repeated) { ... }
{code}

with


{code}
@Target({ METHOD, CONSTRUCTOR })
@Retention(RUNTIME)
@Constraint(validatedBy = {})
@Documented
@ScriptAssert(lang = "", script = "", alias = "args", validationAppliesTo = PARAMETERS)
public @interface ParametersAssert {

    String message() default "{org.hibernate.validator.constraints.ParametersAssert.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    @OverridesAttribute(constraint = ScriptAssert.class, name = "script")
    String script();

    @OverridesAttribute(constraint = ScriptAssert.class, name = "lang")
    String lang();
}
{code}

In addition to accessing the parameters array directly
,  the parameters could also be bound to the script engine context under their names as retrieved from the current parameter name provider, allowing for even more concise expressions:

{code}
@ParametersAssert(script="args0 == args1", lang="javascript")
public void resetPassword(String password, String repeated) { ... }
{code}


This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira