Examples of CustomNumberEditor


Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

    this.defaultEditors.put(boolean.class, new CustomBooleanEditor(false));
    this.defaultEditors.put(Boolean.class, new CustomBooleanEditor(true));

    // The JDK does not contain default editors for number wrapper types!
    // Override JDK primitive number editors with our own CustomNumberEditor.
    this.defaultEditors.put(byte.class, new CustomNumberEditor(Byte.class, false));
    this.defaultEditors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
    this.defaultEditors.put(short.class, new CustomNumberEditor(Short.class, false));
    this.defaultEditors.put(Short.class, new CustomNumberEditor(Short.class, true));
    this.defaultEditors.put(int.class, new CustomNumberEditor(Integer.class, false));
    this.defaultEditors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
    this.defaultEditors.put(long.class, new CustomNumberEditor(Long.class, false));
    this.defaultEditors.put(Long.class, new CustomNumberEditor(Long.class, true));
    this.defaultEditors.put(float.class, new CustomNumberEditor(Float.class, false));
    this.defaultEditors.put(Float.class, new CustomNumberEditor(Float.class, true));
    this.defaultEditors.put(double.class, new CustomNumberEditor(Double.class, false));
    this.defaultEditors.put(Double.class, new CustomNumberEditor(Double.class, true));
    this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
    this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));

    // Only register config value editors if explicitly requested.
    if (this.configValueEditorsActive) {
      this.defaultEditors.put(String[].class, new StringArrayPropertyEditor());
    }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

    this.defaultEditors.put(boolean.class, new CustomBooleanEditor(false));
    this.defaultEditors.put(Boolean.class, new CustomBooleanEditor(true));

    // The JDK does not contain default editors for number wrapper types!
    // Override JDK primitive number editors with our own CustomNumberEditor.
    this.defaultEditors.put(byte.class, new CustomNumberEditor(Byte.class, false));
    this.defaultEditors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
    this.defaultEditors.put(short.class, new CustomNumberEditor(Short.class, false));
    this.defaultEditors.put(Short.class, new CustomNumberEditor(Short.class, true));
    this.defaultEditors.put(int.class, new CustomNumberEditor(Integer.class, false));
    this.defaultEditors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
    this.defaultEditors.put(long.class, new CustomNumberEditor(Long.class, false));
    this.defaultEditors.put(Long.class, new CustomNumberEditor(Long.class, true));
    this.defaultEditors.put(float.class, new CustomNumberEditor(Float.class, false));
    this.defaultEditors.put(Float.class, new CustomNumberEditor(Float.class, true));
    this.defaultEditors.put(double.class, new CustomNumberEditor(Double.class, false));
    this.defaultEditors.put(Double.class, new CustomNumberEditor(Double.class, true));
    this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
    this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));

    // Only register config value editors if explicitly requested.
    if (this.configValueEditorsActive) {
      StringArrayPropertyEditor sae = new StringArrayPropertyEditor();
      this.defaultEditors.put(String[].class, sae);
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

    this.defaultEditors.put(boolean.class, new CustomBooleanEditor(false));
    this.defaultEditors.put(Boolean.class, new CustomBooleanEditor(true));

    // The JDK does not contain default editors for number wrapper types!
    // Override JDK primitive number editors with our own CustomNumberEditor.
    this.defaultEditors.put(byte.class, new CustomNumberEditor(Byte.class, false));
    this.defaultEditors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
    this.defaultEditors.put(short.class, new CustomNumberEditor(Short.class, false));
    this.defaultEditors.put(Short.class, new CustomNumberEditor(Short.class, true));
    this.defaultEditors.put(int.class, new CustomNumberEditor(Integer.class, false));
    this.defaultEditors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
    this.defaultEditors.put(long.class, new CustomNumberEditor(Long.class, false));
    this.defaultEditors.put(Long.class, new CustomNumberEditor(Long.class, true));
    this.defaultEditors.put(float.class, new CustomNumberEditor(Float.class, false));
    this.defaultEditors.put(Float.class, new CustomNumberEditor(Float.class, true));
    this.defaultEditors.put(double.class, new CustomNumberEditor(Double.class, false));
    this.defaultEditors.put(Double.class, new CustomNumberEditor(Double.class, true));
    this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
    this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));

    // Only register config value editors if explicitly requested.
    if (this.configValueEditorsActive) {
      this.defaultEditors.put(String[].class, new StringArrayPropertyEditor());
    }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

    this.defaultEditors.put(boolean.class, new CustomBooleanEditor(false));
    this.defaultEditors.put(Boolean.class, new CustomBooleanEditor(true));

    // The JDK does not contain default editors for number wrapper types!
    // Override JDK primitive number editors with our own CustomNumberEditor.
    this.defaultEditors.put(byte.class, new CustomNumberEditor(Byte.class, false));
    this.defaultEditors.put(Byte.class, new CustomNumberEditor(Byte.class, true));
    this.defaultEditors.put(short.class, new CustomNumberEditor(Short.class, false));
    this.defaultEditors.put(Short.class, new CustomNumberEditor(Short.class, true));
    this.defaultEditors.put(int.class, new CustomNumberEditor(Integer.class, false));
    this.defaultEditors.put(Integer.class, new CustomNumberEditor(Integer.class, true));
    this.defaultEditors.put(long.class, new CustomNumberEditor(Long.class, false));
    this.defaultEditors.put(Long.class, new CustomNumberEditor(Long.class, true));
    this.defaultEditors.put(float.class, new CustomNumberEditor(Float.class, false));
    this.defaultEditors.put(Float.class, new CustomNumberEditor(Float.class, true));
    this.defaultEditors.put(double.class, new CustomNumberEditor(Double.class, false));
    this.defaultEditors.put(Double.class, new CustomNumberEditor(Double.class, true));
    this.defaultEditors.put(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, true));
    this.defaultEditors.put(BigInteger.class, new CustomNumberEditor(BigInteger.class, true));

    // Only register config value editors if explicitly requested.
    if (this.configValueEditorsActive) {
      StringArrayPropertyEditor sae = new StringArrayPropertyEditor();
      this.defaultEditors.put(String[].class, sae);
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

  public void testCustomNumberEditorWithAllowEmpty() throws Exception {
    final NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN);

    TestController mc = new TestController() {
      protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
        binder.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
      }
    };

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome.html");
    request.addParameter("myFloat", "5,1");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

  public void testCustomNumberEditorWithoutAllowEmpty() throws Exception {
    final NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN);

    TestController mc = new TestController() {
      protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
        binder.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, false));
      }
    };

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/welcome.html");
    request.addParameter("myFloat", "5,1");
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

  }

  public void testGenericMapWithCollectionValue() {
    GenericBean gb = new GenericBean();
    BeanWrapper bw = new BeanWrapperImpl(gb);
    bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
    Map input = new HashMap();
    HashSet value1 = new HashSet();
    value1.add(new Integer(1));
    input.put("1", value1);
    ArrayList value2 = new ArrayList();
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

  public void testGenericMapElementWithCollectionValue() {
    GenericBean gb = new GenericBean();
    gb.setCollectionMap(new HashMap<Number, Collection<? extends Object>>());
    BeanWrapper bw = new BeanWrapperImpl(gb);
    bw.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
    HashSet value1 = new HashSet();
    value1.add(new Integer(1));
    bw.setPropertyValue("collectionMap[1]", value1);
    assertTrue(gb.getCollectionMap().get(new Integer(1)) instanceof HashSet);
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

  }

  public void testBindingWithCustomEditorOnObjectField() {
    BeanWithObjectProperty tb = new BeanWithObjectProperty();
    DataBinder binder = new DataBinder(tb);
    binder.registerCustomEditor(Integer.class, "object", new CustomNumberEditor(Integer.class, true));
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("object", "1");
    binder.bind(pvs);
    assertEquals(new Integer(1), tb.getObject());
  }
View Full Code Here

Examples of org.springframework.beans.propertyeditors.CustomNumberEditor

    assertEquals("7", gb.getLongMap().get(new Long("6")));
  }

  public void testGenericMapWithCollectionValueConstructor() throws MalformedURLException {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    bf.registerCustomEditor(Number.class, new CustomNumberEditor(Integer.class, false));
    RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);

    Map input = new HashMap();
    HashSet value1 = new HashSet();
    value1.add(new Integer(1));
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.