Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.MutableByteConverter


    register(MutableLong.class, new MutableLongConverter(this));

    ByteConverter byteConverter = new ByteConverter();
    register(Byte.class, byteConverter);
    register(byte.class, byteConverter);
    register(MutableByte.class, new MutableByteConverter(this));

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


    register(MutableLong.class, new MutableLongConverter(this));

    ByteConverter byteConverter = new ByteConverter();
    register(Byte.class, byteConverter);
    register(byte.class, byteConverter);
    register(MutableByte.class, new MutableByteConverter(this));

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

public class MutableByteConverterTest {

  @Test
  public void testConversion() {
    MutableByteConverter mutableByteConverter = (MutableByteConverter) TypeConverterManager.lookup(MutableByte.class);

    assertNull(mutableByteConverter.convert(null));

    assertEquals(new MutableByte((byte) 1), mutableByteConverter.convert(new MutableByte((byte) 1)));
    assertEquals(new MutableByte((byte) 1), mutableByteConverter.convert(Integer.valueOf(1)));
    assertEquals(new MutableByte((byte) 1), mutableByteConverter.convert(Short.valueOf((short) 1)));
    assertEquals(new MutableByte((byte) 1), mutableByteConverter.convert(Double.valueOf(1.0D)));
    assertEquals(new MutableByte((byte) 1), mutableByteConverter.convert("1"));
    assertEquals(new MutableByte((byte) 1), mutableByteConverter.convert(" 1 "));

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

TOP

Related Classes of jodd.typeconverter.impl.MutableByteConverter

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.