Vivian Steller commented on Improvement BVAL-240

what's the status on this? any chance to get something done in this area for BV1.1?

I'd really like be able to have cross-field validation annotations on property level rather than solely on class level. Consider the following example, which is really ugly in my opinion if implemented on bean level:

Consider @Max would be a binary constraint, allowing to reference another property that provides the maximum value. This is what I would like to do:

public class Bean {
   private int a;

   @Max("#{a}") // or maybe another notation to reference properties, e.g. simply "a"
   private int b;
...
}

Implementing this on bean level is really ugly, isn't it?:

@Max(target = "#{b}", value="#{a}")
public class Bean {
   private int a;
   private int b;
}

I know, using @ScriptAssert might make the second version more readable, however, it's the same issue if you have large beans with more cross-level constraints. IMO @Max("#{a}") is not only the most readable but also much more consistent with the unary @Max constraint.

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