On Monday, January 7, 2013 4:50:03 PM UTC+1, Nick Chalko wrote: > > > > > On Mon, Jan 7, 2013 at 7:42 AM, Thomas Broyer <t.br...@gmail.com<javascript:> > > wrote: > >> >> >> On Monday, January 7, 2013 3:45:53 PM UTC+1, membersound wrote: >>> >>> Yes I know this side. But it still does not tell me: >>> - how to validate the name before creating the person object (which I'm >>> looking for in terms of numbers like int age; There I'd first like the >>> validator to catch if it's a valid age before creating the person object) >> >> >> If you want to use the annotations that are on your Person fields, then >> you have to create a Person object. >> Technically, I believe you could generate code, the generator reading the >> annotations and producing code that will be able to validate data before >> creating the Person object, but there's no such things in GWT proper. >> That being said, creating a Person object shouldn't be that expensive >> that you want to avoid it a all costs. >> >> > > > http://docs.oracle.com/javaee/6/api/javax/validation/Validator.html#validateValue(java.lang.Class, > > java.lang.String, java.lang.Object, java.lang.Class...) > > validateValue > > <T> java.util.Set<ConstraintViolation > <http://docs.oracle.com/javaee/6/api/javax/validation/ConstraintViolation.html><T>> > *validateValue*(java.lang.Class<T> beanType, > java.lang.String > propertyName, > java.lang.Object > value, > java.lang.Class<?>... > groups) > > Validates all constraints placed on the property named propertyName of > the class beanType would the property value be value > > ConstraintViolation objects return null for > ConstraintViolation#getRootBean() and ConstraintViolation#getLeafBean() >
Ooh, great! Thanks for the tip Nick. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RPL7MVRxYjgJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.