[Grails 2.3.11] GrailsDataBinder issue in src/groovy
This post was updated on .
I am working with Grails 2.1.3. Recently upgraded to Grails 2.3.11.
I am trying to bind date field. Earlier with 2.1.3 it was able to bind date by parsing it automatically based on date format specified. But after upgrading to 2.3.11 it is not binding that date value.
I have a class which is subclassed with specific properties. Both classes are in src/groovy. Child class is marked as @Validateable and here constraints are specified. Now, date field is specified in parent class, which is not marked with any annotation.
Child class is been initialized using new operator.
Here is the code snippet which binds data to child class. This code snippet is from Service class.
To bind data field I have marked date field as @BindUsing. It works at other places where the class is bound directly in Controller, but not working here. It is giving null on accessing the property.
I am not sure but I think the value is not binding because of its type i.e. java.util.Date. Because String objects are bound properly. Will ValueConverter works fine to solve this? If so, can I have a good link to implement ValueConverter for date field?
Any idea why it is not binding value to the class?
Note: I can not go for @BindingFormat, because the date-time format is locale based and not been read from properties file. It is depends on request from client. So, it will be always locale of client system.