Validation must be made in your class Personal Controler. So, the relevant class must knows the setters and getters from the Class Person so that you can polimorfically used them and treat the validation itself. Neverthelesss, you can create an interface or something like.
cheers Filipe and Silas from MIT Institute On Jun 7, 9:39 am, miga <[email protected]> wrote: > On Jun 7, 4:00 pm, anaclos <[email protected]> wrote:> Hello: > > I am trying to separate responsabilities in 3 clases. A Class Person > > whith atributes weigth and height, a constructor, setters and getters, > > and a method that calculates the BMI (Body Mass Index). A class > > PersonForm whith a text field for weigth, another for heigth, another > > for BMI, and a buttom Calculate. I have a PersonControler that > > listener when the user press the buttom, send the weigth and the > > height to the class Person, retrieave the BMI and send the value to > > the text field. What is the correct place to validate that the text > > fields not were empty and the weigth and the height were numbers >0? > > (sorry for my english). > > I would say in the Person class. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
