Mesith / android-binding

Automatically exported from code.google.com/p/android-binding
0 stars 0 forks source link

Model Validation with ErrorMessagRes does not working #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. add annotation to Model property: 
@Required(ErrorMessagRes = R.string.error_message)
2. call ValidationResult valRes = ModelValidator.ValidateModel(model);
3. valRes.getValidationErrors()

result is: empty instead of error_message from resource

Original issue reported on code.google.com by multisof...@gmail.com on 3 Jan 2012 at 1:24

GoogleCodeExporter commented 9 years ago

Original comment by gueei....@gmail.com on 9 Jan 2012 at 2:50

GoogleCodeExporter commented 9 years ago
Reworked Validation framework. 

I planned to remove validation from the main library in later releases, but 
until then, the validation is under "labs" sub package: 
gueei.binding.labs.validation

While keeping validators almost the same, lots of underlying changes is made. 
The Resource String no longer handled by individual validators but the 
ModelValidator since additional knowledge on the Context and Class containing 
the resource string is required. 

Since no more constant res id, to get around that issue, resource is given by 
the name instead, and ModelValidator will try to turn the name to int and to 
the localized resource string, defined in final XML file. 

Another improvement is the Error Message returned by ModelValidator contains 
individual Property's error message, in a hashtable <name, array> manner. 

Original comment by gueei....@gmail.com on 5 Mar 2012 at 8:17