Hi,

I was thinking about the several ways that exist to validate a field value....

 

I had some ideas, but I was wondering if there is a  pattern that does it...

 

 

In my entity bean, I am using the pattern VO and when I'm setting the cmp fields,

I wanna make a validation of some fields but I don't want to put this validation inside

this method.

Ex:

public void setDVO(ArrayDVO pmtDvo)

   {

      setName((String)pmtDvo.getFieldByName(this.ATTR_02));

      setAge((Integer) pmtDvo.getFieldByName(this.ATTR_03));

      setAddress((String)pmtDvo.getFieldByName(this.ATTR_04));

  }

In this case, I would like to validate if the age value is a correct number..... but I don't want to put

this validation inside this method setDVO().

The way I was doing was:

            creating the method setVldAge(Integer age) and inside this method, after validating it, I used

to call the setAge.....  and in the method setDVO() I was calling the setVldAge(..) instead of calling the

setAge(..)

            But, I don´t think that this is the best alternative...

            I think that using a pattern would be a better solution....

 

 

How do you usually validate these fields?

 

Thanks,

Tânia Ramos

Analista de Sistemas - NDS

* [EMAIL PROTECTED]

Fóton® Informática e Serviços

( Fone: (61) 328 5060 R.240

 

Reply via email to