Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is needed to check the length of fields?  RSS feed

 
Pedro Su�rez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I'm writing an Object Value for holding any record I read from the file. But I'm unsure if I should check the length of the fields with the 'sets' methods. This forced me to throw an exception if the length is exceeded. Also, since the constructor should checks the values of fields as well, I don't know if I could call the sets methods from the constructor without breaking the sun code convention rules (calling the sets methods from the constructor I avoid repeat the check code that is written in the sets methods).

Thanks a lot!.
 
Romeo Kienzler
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pedro,
please see this thread.

So I think you have to validate. The only question ist WHERE to validate. In the DTOs or in the database itself.

Greetings,
Romeo
[ August 15, 2007: Message edited by: Romeo Kienzler ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!