Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.MutableIntegerConverter


    register(String[].class, new StringArrayConverter(this));

    IntegerConverter integerConverter = new IntegerConverter();
    register(Integer.class, integerConverter);
    register(int.class, integerConverter);
    register(MutableInteger.class, new MutableIntegerConverter(this));

    ShortConverter shortConverter = new ShortConverter();
    register(Short.class, shortConverter);
    register(short.class, shortConverter);
    register(MutableShort.class, new MutableShortConverter(this));
View Full Code Here


    register(String[].class, new StringArrayConverter(this));

    IntegerConverter integerConverter = new IntegerConverter();
    register(Integer.class, integerConverter);
    register(int.class, integerConverter);
    register(MutableInteger.class, new MutableIntegerConverter(this));

    ShortConverter shortConverter = new ShortConverter();
    register(Short.class, shortConverter);
    register(short.class, shortConverter);
    register(MutableShort.class, new MutableShortConverter(this));
View Full Code Here

public class MutableIntegerConverterTest {

  @Test
  public void testConversion() {
    MutableIntegerConverter mutableIntegerConverter = (MutableIntegerConverter) TypeConverterManager.lookup(MutableInteger.class);

    assertNull(mutableIntegerConverter.convert(null));

    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(new MutableInteger(1)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(Integer.valueOf(1)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(Short.valueOf((short) 1)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(Double.valueOf(1.0D)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert("1"));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(" 1 "));

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

TOP

Related Classes of jodd.typeconverter.impl.MutableIntegerConverter

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.