Description:
|
{{@ScriptAssert}} should be allowed to be used as cross-parameter constraint.
Maybe we should 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}
|