Code example for MutablePropertyValues

Methods: addPropertyValue

0
        System.setProperty(DataBinderManager.PROPERTY_DATA_BINDER, SpringDataBinder.class.getName());
    } 
 
    @Test
    public void testBindListWithGenericType() throws Exception {
        MutablePropertyValues values = new MutablePropertyValues();
        values.addPropertyValue("USERACTION", "RELEASE");
        values.addPropertyValue("ATTACHMENTS[0].attachSequence", "1");
        values.addPropertyValue("ATTACHMENTS[0].attachStatus", "var_status");
        values.addPropertyValue("ATTACHMENTS[0].attachmentID", "var_attachmentID");
        values.addPropertyValue("ATTACHMENTS[0].attachmentDate", "15/02/2012");
 
        AttachmentListResultBean target = new AttachmentListResultBean();
        DataBinder binder = new DataBinder(target);
 
        // set the conversion service to convert the date 
        DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
        conversionService.addFormatterForFieldAnnotation(new JodaDateTimeFormatAnnotationFormatterFactory());
        binder.setConversionService(conversionService);