Tuesday, July 26, 2011

Re: Question about the API of Validation

Solved. 

The problem is in the @Valid constraint (the validator of that constraint doesn´t allow parameterizeds types belonging to the package java.util).

I use @Size and works perfectly.

Thanks.

2011/7/22 Adolfo Panizo Touzon <adolfo.panizo@gmail.com>
Ok.
I have two simple class: Person and Email.

Also I´m  using the api of validation that includes in the gwt-2.4.0, and the configuration of the module is correct (because if I comment the @Valid contraints the code works well).

The Person class class has some fields that belong to the java package java.util and are annotated with the @Valid constraint. 

class Person{

//Works fine
@Valid
private HashMap<String, Email> codigos;

//Not work. 
@Valid
private HashMap<Integer, HashMap<String,Email>> movidas;

//Works fine
@Valid
private ArrayList<Email> mails;
}

Finally the code that raise the exception are:

public class GenValGui implements EntryPoint {
public void onModuleLoad() {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
ErrMessagePanel emp =new ErrMessagePanel();
Person p = new Person(......);
validator.validate(p, Default.class);
}
}

The deduction of this behavior is logic, the validation api does not allow validate nested java.util fields like ArrayList<ArrayList<String>>.

My question is that if in the future will be allowed or a restriction that must always be so.

Thank you very much for answering and if I have not explained well or you need more information, let me know.

Thanks.

Adolfo.

2011/7/22 Nick Chalko <nchalko@google.com>


On Thu, Jul 21, 2011 at 2:45 AM, Adolfo Panizo Touzon <adolfo.panizo@gmail.com> wrote:
As I said in another email I'm working with gwt api validation.

Now I'm doing some tests, it is still not allowed the validation of fields belonging to the package java.util with @Valid constraint.


Can you show the code you have that fails.   

You might also try the GWT 2.4 beta it includes Validation see http://code.google.com/p/google-web-toolkit/wiki/BeanValidation.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
El precio es lo que pagas. El valor es lo que recibes.
Warren Buffet



--
El precio es lo que pagas. El valor es lo que recibes.
Warren Buffet

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment