Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.MutableFloatConverter


    register(MutableByte.class, new MutableByteConverter(this));

    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));
View Full Code Here


    register(MutableByte.class, new MutableByteConverter(this));

    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));
View Full Code Here

public class MutableFloatConverterTest {

  @Test
  public void testConversion() {
    MutableFloatConverter mutableFloatConverter = (MutableFloatConverter) TypeConverterManager.lookup(MutableFloat.class);

    assertNull(mutableFloatConverter.convert(null));

    assertEquals(new MutableFloat(1.73f), mutableFloatConverter.convert(new MutableFloat(1.73f)));
    assertEquals(new MutableFloat(1), mutableFloatConverter.convert(Integer.valueOf(1)));
    assertEquals(new MutableFloat(1.73f), mutableFloatConverter.convert(Double.valueOf(1.73D)));
    assertEquals(new MutableFloat(1.73f), mutableFloatConverter.convert(" 1.73 "));
    assertEquals(new MutableFloat(1.73f), mutableFloatConverter.convert(new BigDecimal("1.73")));

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

TOP

Related Classes of jodd.typeconverter.impl.MutableFloatConverter

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.