Package jodd.typeconverter.impl

Examples of jodd.typeconverter.impl.StringArrayConverter


   * Registers default set of converters.
   */
  @SuppressWarnings( {"UnnecessaryFullyQualifiedName"})
  public void registerDefaults() {
    register(String.class, new StringConverter());
    register(String[].class, new StringArrayConverter(this));

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


public class StringArrayConverterTest {

  @Test
  public void testConversion() {
    StringArrayConverter stringArrayConverter = (StringArrayConverter) TypeConverterManager.lookup(String[].class);

    assertNull(stringArrayConverter.convert(null));

    assertEq(arrs(Double.class.getName()), stringArrayConverter.convert(Double.class));
    assertEq(arrs("173"), stringArrayConverter.convert("173"));
    assertEq(arrs("173", "1022"), stringArrayConverter.convert("173,1022"));
    assertEq(arrs("173", " 1022"), stringArrayConverter.convert("173, 1022"));
    assertEq(arrs("173", "1022"), stringArrayConverter.convert(arrs("173", "1022")));
    assertEq(arrs("1", "7", "3"), stringArrayConverter.convert(arri(1, 7, 3)));
    assertEq(arrs("1", "7", "3"), stringArrayConverter.convert(arrl(1, 7, 3)));
    assertEq(arrs("1.0", "7.0", "3.0"), stringArrayConverter.convert(arrd(1, 7, 3)));
    assertEq(arrs("1.0", "7.0", "3.0"), stringArrayConverter.convert(arrf(1, 7, 3)));
    assertEq(arrs("173", "true"), stringArrayConverter.convert(arro("173", Boolean.TRUE)));
    assertEq(arrs("173", "java.lang.String"), stringArrayConverter.convert(arro("173", String.class)));
  }
View Full Code Here

   * Registers default set of converters.
   */
  @SuppressWarnings( {"UnnecessaryFullyQualifiedName"})
  public void registerDefaults() {
    register(String.class, new StringConverter());
    register(String[].class, new StringArrayConverter(this));

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

TOP

Related Classes of jodd.typeconverter.impl.StringArrayConverter

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.