Package org.springframework.batch.item.file.transform

Examples of org.springframework.batch.item.file.transform.DefaultFieldSet


    mapper = new TupleFieldSetMapper();
  }

  @Test
  public void testVanillaTupleCreation() throws Exception {
    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    Tuple result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getString(0));
    assertEquals(true, result.getBoolean(1));
    assertEquals('C', result.getChar(2));
View Full Code Here


        put("field9", FieldSetType.LONG);
        put("field10", FieldSetType.SHORT);
        put("field11", FieldSetType.STRING);
      }
    });
    FieldSet fieldSet = new DefaultFieldSet(new String[] { "19.95", "true", "1", "M", "1977-10-22", "2.22", "9.99",
      "5", "9", "10", "some dummy string", "2007-06-23" },
        new String[] { "field1", "field2", "field3", "field4", "field5", "field6", "field7", "field8",
          "field9", "field10", "field11", "field12" });
    Tuple result = mapper.mapFieldSet(fieldSet);
    assertEquals(new BigDecimal("19.95"), result.getValue("field1"));
View Full Code Here

  @Test
  public void testCustomDateFormatting() throws Exception {
    SimpleDateFormat customFormatter = new SimpleDateFormat("MM/dd/yyyy hh:mm a");
    mapper.setDateFormat(customFormatter);

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "10/22/1977 01:25 AM" }, new String[] { "dateField" });

    Tuple result = mapper.mapFieldSet(fieldSet);

    assertEquals(customFormatter.parse("10/22/1977 01:25 AM"), result.getDate(0));
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.item.file.transform.DefaultFieldSet

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.