Examples of registerCustomEditor()


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

    @SuppressWarnings("unchecked")
    protected Errors doValidation(Class clazz, String path, Object value) throws Exception {
        DomainEntity object = (DomainEntity) ClassUtils.instantiateClass(clazz);
        object.initialize(contextHolder);
        BeanWrapper validatable = new BeanWrapperImpl(object);
        validatable.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), false));
        validatable.setPropertyValue(path, value);
        Errors errors = new BeanPropertyBindingResult(object, "target");
        validator.validate(object, errors);
        return errors;
    }
View Full Code Here

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

    // Set bean properties from init parameters.
    try {
      PropertyValues pvs = new FilterConfigPropertyValues(filterConfig, this.requiredProperties);
      BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
      ResourceLoader resourceLoader = new ServletContextResourceLoader(filterConfig.getServletContext());
      bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader));
      initBeanWrapper(bw);
      bw.setPropertyValues(pvs, true);
    } catch (BeansException ex) {
      String msg = "Failed to set bean properties on filter '" + filterConfig.getFilterName() + "': "
          + ex.getMessage();
View Full Code Here

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

                    throw new IllegalArgumentException(
                        "[propertyEditor] is required on CustomPropertyEditor instances!");
                }

                if (StringUtils.hasLength(customPropertyEditor.getPropertyPath())) {
                    beanWrapper.registerCustomEditor(customPropertyEditor.getRequiredType(),
                        customPropertyEditor.getPropertyPath(), customPropertyEditor.getPropertyEditor());
                } else {
                    beanWrapper.registerCustomEditor(customPropertyEditor.getRequiredType(),
                        customPropertyEditor.getPropertyEditor());
                }
View Full Code Here

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

                if (StringUtils.hasLength(customPropertyEditor.getPropertyPath())) {
                    beanWrapper.registerCustomEditor(customPropertyEditor.getRequiredType(),
                        customPropertyEditor.getPropertyPath(), customPropertyEditor.getPropertyEditor());
                } else {
                    beanWrapper.registerCustomEditor(customPropertyEditor.getRequiredType(),
                        customPropertyEditor.getPropertyEditor());
                }
            }
        }
View Full Code Here

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

    tb2.setNestedIndexedBean(new IndexedTestBean());
    tb3.setNestedIndexedBean(new IndexedTestBean());
    tb4.setNestedIndexedBean(new IndexedTestBean());
    tb5.setNestedIndexedBean(new IndexedTestBean());
    BeanWrapper bw = new BeanWrapperImpl(bean);
    bw.registerCustomEditor(String.class, "array.nestedIndexedBean.array.name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("array" + text);
      }

      public String getAsText() {
View Full Code Here

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

      public String getAsText() {
        return ((String) getValue()).substring(5);
      }
    });
    bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list.name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("list" + text);
      }

      public String getAsText() {
View Full Code Here

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

      public String getAsText() {
        return ((String) getValue()).substring(4);
      }
    });
    bw.registerCustomEditor(String.class, "map.nestedIndexedBean.map.name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("map" + text);
      }

      public String getAsText() {
View Full Code Here

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

    tb2.setNestedIndexedBean(new IndexedTestBean());
    tb3.setNestedIndexedBean(new IndexedTestBean());
    tb4.setNestedIndexedBean(new IndexedTestBean());
    tb5.setNestedIndexedBean(new IndexedTestBean());
    BeanWrapper bw = new BeanWrapperImpl(bean);
    bw.registerCustomEditor(String.class, "array[0].nestedIndexedBean.array[0].name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("array" + text);
      }
    });
    bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list[1].name", new PropertyEditorSupport() {
View Full Code Here

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

    bw.registerCustomEditor(String.class, "array[0].nestedIndexedBean.array[0].name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("array" + text);
      }
    });
    bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list[1].name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("list" + text);
      }
    });
    bw.registerCustomEditor(String.class, "map[key1].nestedIndexedBean.map.name", new PropertyEditorSupport() {
View Full Code Here

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

    bw.registerCustomEditor(String.class, "list.nestedIndexedBean.list[1].name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("list" + text);
      }
    });
    bw.registerCustomEditor(String.class, "map[key1].nestedIndexedBean.map.name", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        setValue("map" + text);
      }
    });
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.