Package org.springframework.beans

Examples of org.springframework.beans.BeanWrapperImpl.findCustomEditor()


    bw.registerCustomEditor(null, "list.age", pe);
    TestBean tb = new TestBean();
    bw.setPropertyValue("list", new ArrayList());
    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }
View Full Code Here


    TestBean tb = new TestBean();
    bw.setPropertyValue("list", new ArrayList());
    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }

  public void testArrayToArrayConversion() throws PropertyVetoException {
View Full Code Here

    bw.setPropertyValue("list", new ArrayList());
    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }

  public void testArrayToArrayConversion() throws PropertyVetoException {
    IndexedTestBean tb = new IndexedTestBean();
View Full Code Here

    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }

  public void testArrayToArrayConversion() throws PropertyVetoException {
    IndexedTestBean tb = new IndexedTestBean();
    BeanWrapper bw = new BeanWrapperImpl(tb);
View Full Code Here

        try {
          BeanWrapper bw = new BeanWrapperImpl(element);
          bw.registerCustomEditor(Date.class, new CustomDateEditor(DATE_FORMAT, true));
         
          for (Mapping mapping : mappings) {
            PropertyEditor editor = bw.findCustomEditor(null, mapping.getField());
            if( editor != null ) {
              try {
                Object propertyData = bw.getPropertyValue(mapping.getField());
                editor.setValue(propertyData);
                row[pos] = editor.getAsText();
View Full Code Here

    bw.registerCustomEditor(null, "list.age", pe);
    TestBean tb = new TestBean();
    bw.setPropertyValue("list", new ArrayList<Object>());
    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }
View Full Code Here

    TestBean tb = new TestBean();
    bw.setPropertyValue("list", new ArrayList<Object>());
    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }

  @Test
View Full Code Here

    bw.setPropertyValue("list", new ArrayList<Object>());
    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }

  @Test
  public void testArrayToArrayConversion() throws PropertyVetoException {
View Full Code Here

    bw.setPropertyValue("list[0]", tb);
    assertEquals(tb, bean.getList().get(0));
    assertEquals(pe, bw.findCustomEditor(int.class, "list.age"));
    assertEquals(pe, bw.findCustomEditor(null, "list.age"));
    assertEquals(pe, bw.findCustomEditor(int.class, "list[0].age"));
    assertEquals(pe, bw.findCustomEditor(null, "list[0].age"));
  }

  @Test
  public void testArrayToArrayConversion() throws PropertyVetoException {
    IndexedTestBean tb = new IndexedTestBean();
View Full Code Here

            String propertyName = field.getFieldConfig().getPropertyName();

            if (bean.isReadableProperty(propertyName)) {
                Object propertyValue = bean.getPropertyValue(propertyName);
                Class<?> propertyType = bean.getPropertyType(propertyName);
                PropertyEditor editor = bean.findCustomEditor(propertyType, propertyName);

                if (editor == null) {
                    editor = BeanUtils.findEditorByConvention(propertyType);
                }
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.