Examples of registerCustomEditor()


Examples of org.springframework.beans.PropertyEditorRegistry.registerCustomEditor()

    protected AbstractPropertyBindingResult getInternalBindingResult() {
        AbstractPropertyBindingResult bindingResult = super.getInternalBindingResult();

        // by rose
        PropertyEditorRegistry registry = bindingResult.getPropertyEditorRegistry();
        registry.registerCustomEditor(Date.class, new DateEditor(Date.class));
        registry.registerCustomEditor(java.sql.Date.class, new DateEditor(java.sql.Date.class));
        registry.registerCustomEditor(java.sql.Time.class, new DateEditor(java.sql.Time.class));
        registry.registerCustomEditor(java.sql.Timestamp.class, new DateEditor(
                java.sql.Timestamp.class));
        return bindingResult;
View Full Code Here

Examples of org.springframework.beans.factory.config.ConfigurableListableBeanFactory.registerCustomEditor()

   private ConfigurableListableBeanFactory createBeanFactory( String jndiConfigLocation )
   {
      ConfigurableListableBeanFactory beanFactory =
         new XmlBeanFactory( new ClassPathResource( jndiConfigLocation ) );
      beanFactory.registerCustomEditor( Class.class,
                                        new ClassEditor(  ) );
      beanFactory.registerCustomEditor( QName.class,
                                        new QNameEditor(  ) );
      return beanFactory;
   }
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.registerCustomEditor()

  }

  public void testCustomEditor() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
    lbf.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("myFloat", "1,1");
    lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, pvs));
    TestBean testBean = (TestBean) lbf.getBean("testBean");
    assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.registerCustomEditor()

  private Throwable ex = null;

  protected void setUp() throws Exception {
    XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("concurrent.xml", getClass()));
    CustomDateEditor editor = new CustomDateEditor(df, false);
    factory.registerCustomEditor(Date.class, editor);
    this.factory = factory;
  }

  public void testSingleThread() {
    for (int i = 0; i < 100; i++) {
View Full Code Here

Examples of org.springframework.validation.DataBinder.registerCustomEditor()

  public void testBindTagWithIndexedPropertiesAndCustomEditor() throws JspException {
    PageContext pc = createPageContext();
    IndexedTestBean tb = new IndexedTestBean();
    DataBinder binder = new ServletRequestDataBinder(tb, "tb");
    binder.registerCustomEditor(TestBean.class, null, new PropertyEditorSupport() {
      public String getAsText() {
        return "something";
      }
    });
    Errors errors = binder.getBindingResult();
View Full Code Here

Examples of org.springframework.web.bind.ServletRequestDataBinder.registerCustomEditor()

    MultipartTestBean1 mtb1 = new MultipartTestBean1();
    assertEquals(null, mtb1.getField1());
    assertEquals(null, mtb1.getField2());
    ServletRequestDataBinder binder = new ServletRequestDataBinder(mtb1, "mybean");
    binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
    binder.bind(request);
    assertEquals(file1, mtb1.getField1());
    assertEquals(new String(file2.getBytes()), new String(mtb1.getField2()));

    MultipartTestBean2 mtb2 = new MultipartTestBean2();
View Full Code Here

Examples of org.springframework.web.bind.WebDataBinder.registerCustomEditor()

  @Test
  public void missingRequestParamEmptyValueConvertedToNull() throws Exception {

    WebDataBinder binder = new WebRequestDataBinder(null);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

    WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
    given(binderFactory.createBinder(webRequest, null, "stringNotAnnot")).willReturn(binder);

    this.request.addParameter("stringNotAnnot", "");
View Full Code Here

Examples of org.springframework.web.bind.support.WebRequestDataBinder.registerCustomEditor()

  @Test
  public void missingRequestParamEmptyValueConvertedToNull() throws Exception {

    WebDataBinder binder = new WebRequestDataBinder(null);
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));

    WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class);
    given(binderFactory.createBinder(webRequest, null, "stringNotAnnot")).willReturn(binder);

    this.request.addParameter("stringNotAnnot", "");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.