Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.CharacterConverter


    BooleanConverter booleanConverter = new BooleanConverter();
    register(Boolean.class, booleanConverter);
    register(boolean.class, booleanConverter);

    CharacterConverter characterConverter = new CharacterConverter();
    register(Character.class, characterConverter);
    register(char.class, characterConverter);

    register(byte[].class, new ByteArrayConverter(this));
    register(short[].class, new ShortArrayConverter(this));
View Full Code Here


public class CharacterConverterTest {

  @Test
  public void testConversion() {
    CharacterConverter characterConverter = new CharacterConverter();

    assertNull(characterConverter.convert(null));

    assertEquals(Character.valueOf((char) 1), characterConverter.convert(Character.valueOf((char) 1)));
    assertEquals(Character.valueOf((char) 1), characterConverter.convert(Integer.valueOf(1)));
    assertEquals(Character.valueOf((char) 1), characterConverter.convert(Short.valueOf((short) 1)));
    assertEquals(Character.valueOf((char) 1), characterConverter.convert(Double.valueOf(1.0D)));
    assertEquals(new Character('1'), characterConverter.convert("1"));

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

    BooleanConverter booleanConverter = new BooleanConverter();
    register(Boolean.class, booleanConverter);
    register(boolean.class, booleanConverter);

    CharacterConverter characterConverter = new CharacterConverter();
    register(Character.class, characterConverter);
    register(char.class, characterConverter);

    register(byte[].class, new ByteArrayConverter(this));
    register(short[].class, new ShortArrayConverter(this));
View Full Code Here

TOP

Related Classes of jodd.typeconverter.impl.CharacterConverter

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.