Validations

From AardRock Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

We need to validate user-input. One idea is to do it the Rails-way, that way, or model might look something like this:


class User {
   public boolean validate() {
      validatePresenceOf("name"); // a name is mandatory
      validateFormatOf("date", "\d\d\-\d\d\-\d\d\d\d"); // a date must follow this format
   }
}