Package org.springframework.binding.convert.converters

Examples of org.springframework.binding.convert.converters.FormattedStringToNumber


    assertEquals("3", threeString);
  }

  public void testRegisterConverter() {
    GenericConversionService service = new GenericConversionService();
    FormattedStringToNumber converter = new FormattedStringToNumber();
    DefaultNumberFormatFactory numberFormatFactory = new DefaultNumberFormatFactory();
    numberFormatFactory.setLocale(Locale.US);
    converter.setNumberFormatFactory(numberFormatFactory);
    service.addConverter(converter);
    ConversionExecutor executor = service.getConversionExecutor(String.class, Integer.class);
    Integer three = (Integer) executor.execute("3,000");
    assertEquals(3000, three.intValue());
    ConversionExecutor executor2 = service.getConversionExecutor(Integer.class, String.class);
View Full Code Here


    assertEquals("3,000", string);
  }

  public void testRegisterCustomConverter() {
    DefaultConversionService service = new DefaultConversionService();
    FormattedStringToNumber converter = new FormattedStringToNumber();
    DefaultNumberFormatFactory numberFormatFactory = new DefaultNumberFormatFactory();
    numberFormatFactory.setLocale(Locale.US);
    converter.setNumberFormatFactory(numberFormatFactory);
    service.addConverter("usaNumber", converter);
    ConversionExecutor executor = service.getConversionExecutor("usaNumber", String.class, Integer.class);
    Integer three = (Integer) executor.execute("3,000");
    assertEquals(3000, three.intValue());
    ConversionExecutor executor2 = service.getConversionExecutor("usaNumber", Integer.class, String.class);
View Full Code Here

  public void testGetConversionExecutorsForSource() {
    DefaultConversionService service1 = new DefaultConversionService();
    service1.addConverter(new CustomConverter());
    GenericConversionService service2 = new GenericConversionService();
    FormattedStringToNumber formatterConverter = new FormattedStringToNumber(BigDecimal.class);
    service2.addConverter(formatterConverter);
    service2.setParent(service1);
    Set converters = service2.getConversionExecutors(String.class);
    Iterator it = converters.iterator();
    while (it.hasNext()) {
View Full Code Here

    assertEquals("3", threeString);
  }

  public void testRegisterConverter() {
    GenericConversionService service = new GenericConversionService();
    FormattedStringToNumber converter = new FormattedStringToNumber();
    DefaultNumberFormatFactory numberFormatFactory = new DefaultNumberFormatFactory();
    numberFormatFactory.setLocale(Locale.US);
    converter.setNumberFormatFactory(numberFormatFactory);
    service.addConverter(converter);
    ConversionExecutor executor = service.getConversionExecutor(String.class, Integer.class);
    Integer three = (Integer) executor.execute("3,000");
    assertEquals(new Integer(3000), three);
    ConversionExecutor executor2 = service.getConversionExecutor(Integer.class, String.class);
View Full Code Here

    assertEquals("3,000", string);
  }

  public void testRegisterCustomConverter() {
    DefaultConversionService service = new DefaultConversionService();
    FormattedStringToNumber converter = new FormattedStringToNumber();
    DefaultNumberFormatFactory numberFormatFactory = new DefaultNumberFormatFactory();
    numberFormatFactory.setLocale(Locale.US);
    converter.setNumberFormatFactory(numberFormatFactory);
    service.addConverter("usaNumber", converter);
    ConversionExecutor executor = service.getConversionExecutor("usaNumber", String.class, Integer.class);
    Integer three = (Integer) executor.execute("3,000");
    assertEquals(new Integer(3000), three);
    ConversionExecutor executor2 = service.getConversionExecutor("usaNumber", Integer.class, String.class);
View Full Code Here

TOP

Related Classes of org.springframework.binding.convert.converters.FormattedStringToNumber

Copyright © 2018 www.massapicom. 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.