[jboss-user] [JBoss Seam] - Handling context-based validation

thatrichard do-not-reply at jboss.com
Wed Aug 15 06:45:36 EDT 2007


I have a "Claim" object.  Whether or not it is valid depends on what the user is trying to do.

My person object will require payee information to be valid for the purpose of payment, but not otherwise.

Ideally, I'd do something like this:


  |    public void makePayment(Party payee) {
  |        Payee validator = new PayeeValidator();
  |        if (validator.isValid(payee) {
  |            ...
  |        }
  |    }
  | 

At the UI level, I want to show

Valid person: yes/no
Valid payee: yes/no
Valid employee: yes/no

where the yes/no value is determined by calling the relevant validator with the same person object.

This seems to be a limitation of the annotation approach. i.e. you can only specify a set of rules that apply in all contexts.

Anyone else feel the same way?  Am I missing something?

Richard

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074364#4074364

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074364



More information about the jboss-user mailing list