Java 类org.springframework.beans.propertyeditors.CustomDateEditor 实例源码

项目:helium    文件:TascaTramitacioController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientConsultaInformeController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.setAutoGrowNestedPaths(false);
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientInformeController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.setAutoGrowNestedPaths(false);
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientDocumentController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientTokenV3Controller.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientInformacioController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientDadaController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientConsultaLlistatController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.setAutoGrowNestedPaths(false);
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientMassivaController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            byte[].class,
            new ByteArrayMultipartFileEditor());
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
}
项目:helium    文件:TascaFormController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:ExpedientIniciarPasFormController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:ExpedientConsultaDissenyController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.setAutoGrowNestedPaths(false);
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(true));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:CommonRegistreController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:ExpedientDadaModificarController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:spring4-understanding    文件:BindTagTests.java   
@Test
public void transformTagNonExistingValue() throws JspException {
    // first set up the pagecontext and the bean
    PageContext pc = createPageContext();
    TestBean tb = new TestBean();
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "tb");
    CustomDateEditor l = new CustomDateEditor(df, true);
    binder.registerCustomEditor(Date.class, l);
    pc.getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "tb", binder.getBindingResult());

    // try with non-existing value
    BindTag bind = new BindTag();
    bind.setPageContext(pc);
    bind.setPath("tb.name");
    bind.doStartTag();

    TransformTag transform = new TransformTag();
    transform.setPageContext(pc);
    transform.setValue(null);
    transform.setParent(bind);
    transform.setVar("theString2");
    transform.doStartTag();

    assertNull(pc.getAttribute("theString2"));
}
项目:xmanager    文件:BaseController.java   
@InitBinder
public void initBinder(ServletRequestDataBinder binder) {
    /**
     * 自动转换日期类型的字段格式
     */
    binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
    /**
     * 防止XSS攻击
     */
    binder.registerCustomEditor(String.class, new StringEscapeEditor());
}
项目:xmanager    文件:BaseController.java   
@InitBinder
public void initBinder(ServletRequestDataBinder binder) {
    /**
     * 自动转换日期类型的字段格式
     */
    binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
    /**
     * 防止XSS攻击
     */
    binder.registerCustomEditor(String.class, new StringEscapeEditor());
}
项目:https-github.com-in28minutes-SpringIn28Minutes    文件:TodoController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    SimpleDateFormat dateFormat = new SimpleDateFormat(
            TodoListUtils.DATE_FORMAT);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(
            dateFormat, false));
    binder.registerCustomEditor(Priority.class,
            new TodoPriorityPropertyEditor());
}
项目:helium    文件:ReassignacioUsuarisController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:MassivaExpedientController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            byte[].class,
            new ByteArrayMultipartFileEditor());
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientTipusController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
项目:helium    文件:ExpedientInicioPasFormController.java   
@InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(
                Long.class,
                new CustomNumberEditor(Long.class, true));
        binder.registerCustomEditor(
                Double.class,
                new CustomNumberEditor(Double.class, true));
        binder.registerCustomEditor(
                BigDecimal.class,
                new CustomNumberEditor(
                        BigDecimal.class,
                        new DecimalFormat("#,##0.00"),
                        true));
        binder.registerCustomEditor(
                Boolean.class,
//              new CustomBooleanEditor(false));
                new CustomBooleanEditor(true));
        binder.registerCustomEditor(
                Date.class,
                new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
//      binder.registerCustomEditor(
//              TerminiDto.class,
//              new TerminiTypeEditorHelper());
        binder.registerCustomEditor(
                Object.class,
                new ObjectTypeEditorHelper());
    }
项目:helium    文件:TascaLlistatV3Controller.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ExpedientInicioPasTitolController.java   
@InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(
                Long.class,
                new CustomNumberEditor(Long.class, true));
        binder.registerCustomEditor(
                Double.class,
                new CustomNumberEditor(Double.class, true));
        binder.registerCustomEditor(
                BigDecimal.class,
                new CustomNumberEditor(
                        BigDecimal.class,
                        new DecimalFormat("#,##0.00"),
                        true));
        binder.registerCustomEditor(
                Boolean.class,
//              new CustomBooleanEditor(false));
                new CustomBooleanEditor(true));
        binder.registerCustomEditor(
                Date.class,
                new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
//      binder.registerCustomEditor(
//              TerminiDto.class,
//              new TerminiTypeEditorHelper());
        binder.registerCustomEditor(
                Object.class,
                new ObjectTypeEditorHelper());
    }
项目:helium    文件:ExpedientIniciController.java   
@InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(
                Long.class,
                new CustomNumberEditor(Long.class, true));
        binder.registerCustomEditor(
                Double.class,
                new CustomNumberEditor(Double.class, true));
        binder.registerCustomEditor(
                BigDecimal.class,
                new CustomNumberEditor(
                        BigDecimal.class,
                        new DecimalFormat("#,##0.00"),
                        true));
        binder.registerCustomEditor(
                Boolean.class,
//              new CustomBooleanEditor(false));
                new CustomBooleanEditor(true));
        binder.registerCustomEditor(
                Date.class,
                new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
//      binder.registerCustomEditor(
//              TerminiDto.class,
//              new TerminiTypeEditorHelper());
        binder.registerCustomEditor(
                Object.class,
                new ObjectTypeEditorHelper());
    }
项目:helium    文件:ExpedientV3Controller.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            byte[].class,
            new ByteArrayMultipartFileEditor());
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Long.class,
            new CustomNumberEditor(Long.class, true));
    binder.registerCustomEditor(
            Double.class,
            new CustomNumberEditor(Double.class, true));
    binder.registerCustomEditor(
            BigDecimal.class,
            new CustomNumberEditor(
                    BigDecimal.class,
                    new DecimalFormat("#,##0.00"),
                    true));
    binder.registerCustomEditor(
            Boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Object.class,
            new ObjectTypeEditorHelper());
}
项目:helium    文件:ReproController.java   
@InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.registerCustomEditor(
                Long.class,
                new CustomNumberEditor(Long.class, true));
        binder.registerCustomEditor(
                Double.class,
                new CustomNumberEditor(Double.class, true));
        binder.registerCustomEditor(
                BigDecimal.class,
                new CustomNumberEditor(
                        BigDecimal.class,
                        new DecimalFormat("#,##0.00"),
                        true));
        binder.registerCustomEditor(
                Boolean.class,
//              new CustomBooleanEditor(false));
                new CustomBooleanEditor(true));
        binder.registerCustomEditor(
                Date.class,
                new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
//      binder.registerCustomEditor(
//              TerminiDto.class,
//              new TerminiTypeEditorHelper());
        binder.registerCustomEditor(
                Object.class,
                new ObjectTypeEditorHelper());
    }
项目:helium    文件:ExpedientLlistatController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
项目:helium    文件:TascaDocumentsController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            byte[].class,
            new ByteArrayMultipartFileEditor());
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:ExpedientDocumentModificarController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            byte[].class,
            new ByteArrayMultipartFileEditor());
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:PerfilController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:ExpedientDocumentAdjuntController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            byte[].class,
            new ByteArrayMultipartFileEditor());
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:helium    文件:PermisController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            boolean.class,
            new CustomBooleanEditor(false));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
    binder.registerCustomEditor(
            Permis.class,
            new PermisTypeEditor());
}
项目:helium    文件:ExpedientConsultaController.java   
@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(
            ExpedientTipus.class,
            new ExpedientTipusTypeEditor(dissenyService));
    binder.registerCustomEditor(
            Date.class,
            new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
项目:spring4-understanding    文件:Portlet20AnnotationControllerTests.java   
@Override
public void initBinder(WebDataBinder binder, WebRequest request) {
    assertNotNull(request.getLocale());
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
项目:spring4-understanding    文件:PortletAnnotationControllerTests.java   
@Override
public void initBinder(WebDataBinder binder, WebRequest request) {
    assertNotNull(request.getLocale());
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
项目:spring4-understanding    文件:PortletRequestDataBinderTests.java   
@Test
public void bindingDate() throws Exception {
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
    Date expected = dateFormat.parse("06-03-2006");

    request.addParameter("date", "06-03-2006");

    PortletRequestDataBinder binder = new PortletRequestDataBinder(bean);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
    binder.bind(request);

    assertEquals(expected, bean.getDate());
}
项目:spring4-understanding    文件:ServletAnnotationControllerTests.java   
@SuppressWarnings("unused")
@InitBinder
private void initBinder(WebDataBinder binder) {
    binder.initBeanPropertyAccess();
    binder.setRequiredFields("sex");
    LocalValidatorFactoryBean vf = new LocalValidatorFactoryBean();
    vf.afterPropertiesSet();
    binder.setValidator(vf);
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
项目:spring4-understanding    文件:ServletAnnotationControllerTests.java   
@SuppressWarnings("unused")
@InitBinder({"myCommand", "date"})
private void initBinder(WebDataBinder binder, String date, @RequestParam("date") String[] date2) {
    LocalValidatorFactoryBean vf = new LocalValidatorFactoryBean();
    vf.afterPropertiesSet();
    binder.setValidator(vf);
    assertEquals("2007-10-02", date);
    assertEquals(1, date2.length);
    assertEquals("2007-10-02", date2[0]);
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}
项目:spring4-understanding    文件:UriTemplateServletAnnotationControllerHandlerMethodTests.java   
@InitBinder
public void initBinder(WebDataBinder binder, @PathVariable("hotel") String hotel) {
    assertEquals("Invalid path variable value", "42", hotel);
    binder.initBeanPropertyAccess();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}