Most of the time it will be adequate to either use the default type converter. When necessary, it is also possible to specify a particular converter. An example is shown below:
/** * Type conversion using specified converter class */ public class HolidayBookingForm extends ValidBindingForm { private static final long serialVersionUID = -4359715889805708158L; private String startDate; //other properties, getters and setters omitted @BindSimple(expression = "booking.startDate", converter = SQLDateConverter.class) public String getStartDate() { return startDate; } }
In addition, Strecks gives you the flexibility to define the type converter in a separate annotation.
/** * Type conversion using converter annotation */ public class HolidayBookingForm extends ValidBindingForm { private static final long serialVersionUID = -4359715889805708158L; private String startDate; //other properties, getters and setters omitted @BindSimple(expression = "booking.startDate") @ConvertDate(pattern = "yyyy-MM-dd") public String getStartDate() { return startDate; } }