Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.DoubleConverter


    FloatConverter floatConverter = new FloatConverter();
    register(Float.class, floatConverter);
    register(float.class, floatConverter);
    register(MutableFloat.class, new MutableFloatConverter(this));

    DoubleConverter doubleConverter = new DoubleConverter();
    register(Double.class, doubleConverter);
    register(double.class, doubleConverter);
    register(MutableDouble.class, new MutableDoubleConverter(this));

    BooleanConverter booleanConverter = new BooleanConverter();
View Full Code Here


public class DoubleConverterTest {

  @Test
  public void testConversion() {
    DoubleConverter doubleConverter = new DoubleConverter();

    assertNull(doubleConverter.convert(null));

    assertEquals(Double.valueOf(1), doubleConverter.convert(Integer.valueOf(1)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert("1.73"));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" 1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(" +1.73 "));
    assertEquals(Double.valueOf(-1.73), doubleConverter.convert(" -1.73 "));
    assertEquals(Double.valueOf(1.73), doubleConverter.convert(new BigDecimal("1.73")));

    try {
      doubleConverter.convert("aaaa");
      fail();
    } catch (TypeConversionException ignore) {
    }
  }
View Full Code Here

    FloatConverter floatConverter = new FloatConverter();
    register(Float.class, floatConverter);
    register(float.class, floatConverter);
    register(MutableFloat.class, new MutableFloatConverter(this));

    DoubleConverter doubleConverter = new DoubleConverter();
    register(Double.class, doubleConverter);
    register(double.class, doubleConverter);
    register(MutableDouble.class, new MutableDoubleConverter(this));

    BooleanConverter booleanConverter = new BooleanConverter();
View Full Code Here

TOP

Related Classes of jodd.typeconverter.impl.DoubleConverter

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.