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

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


    tokens[TradeFieldSetMapper.ISIN_COLUMN] = ISIN;
    tokens[TradeFieldSetMapper.QUANTITY_COLUMN] = String.valueOf(QUANTITY);
    tokens[TradeFieldSetMapper.PRICE_COLUMN] = String.valueOf(PRICE);
    tokens[TradeFieldSetMapper.CUSTOMER_COLUMN] = CUSTOMER;

    return new DefaultFieldSet(tokens);
  }
View Full Code Here


        values[0] = ""+(count++);
        values[1] = choose(names);
        values[2] = choose(country);
        values[3] = choose(products);
        values[4] = formatter.format(random(amounts));
        items.add(new DefaultFieldSet(values));
      }
      writer.write(items);
    }
    writer.close();
   
View Full Code Here

  public void testVanillaBeanCreatedFromType() throws Exception {
    BeanWrapperFieldSetMapper<TestObject> mapper = new BeanWrapperFieldSetMapper<TestObject>();
    mapper.setTargetType(TestObject.class);
    mapper.afterPropertiesSet();

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

  public void testNullPropertyAutoCreated() throws Exception {
    BeanWrapperFieldSetMapper<TestNestedA> mapper = new BeanWrapperFieldSetMapper<TestNestedA>();
    mapper.setTargetType(TestNestedA.class);
    mapper.afterPropertiesSet();

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "Foo", "Bar" }, new String[] { "valueA",
        "testObjectB.valueA" });
    TestNestedA result = mapper.mapFieldSet(fieldSet);
    assertEquals("Bar", result.getTestObjectB().getValueA());
  }
View Full Code Here

    StaticApplicationContext context = new StaticApplicationContext();
    mapper.setBeanFactory(context);
    context.getBeanFactory().registerSingleton("bean", new TestObject());
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

    mapper.setBeanFactory(context);
    mapper.setDistanceLimit(2);
    context.getBeanFactory().registerSingleton("bean", new TestObject());
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "VarString", "VAR_BOOLEAN", "VAR_CHAR" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

    ApplicationContext context = new ClassPathXmlApplicationContext("bean-wrapper.xml", getClass());

    BeanWrapperFieldSetMapper<TestObject> mapper = (BeanWrapperFieldSetMapper<TestObject>) context
        .getBean("fieldSetMapper");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "true", "C" },
        new String[] { "varString", "varBoolean", "varChar" });
    TestObject result = mapper.mapFieldSet(fieldSet);
    assertEquals("This is some dummy string", result.getVarString());
    assertEquals(true, result.isVarBoolean());
    assertEquals('C', result.getVarChar());
View Full Code Here

    StaticApplicationContext context = new StaticApplicationContext();
    mapper.setBeanFactory(context);
    context.getBeanFactory().registerSingleton("bean", testNestedA);
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(
        new String[] { "This is some dummy string", "1", "Another dummy", "2" }, new String[] { "valueA",
            "valueB", "testObjectB.valueA", "testObjectB.testObjectC.value" });

    TestNestedA result = mapper.mapFieldSet(fieldSet);
View Full Code Here

    mapper.setBeanFactory(context);
    mapper.setDistanceLimit(2);
    context.getBeanFactory().registerSingleton("bean", testNestedA);
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "This is some dummy string", "1" }, new String[] {
        "VALUE_A", "VALUE_B" });

    TestNestedA result = mapper.mapFieldSet(fieldSet);

    assertEquals("This is some dummy string", result.getValueA());
View Full Code Here

    StaticApplicationContext context = new StaticApplicationContext();
    mapper.setBeanFactory(context);
    context.getBeanFactory().registerSingleton("bean", testNestedC);
    mapper.setPrototypeBeanName("bean");

    FieldSet fieldSet = new DefaultFieldSet(new String[] { "1" }, new String[] { "foo" });

    TestNestedC result = mapper.mapFieldSet(fieldSet);

    // "foo" is similar enough to "value" that it matches - but only because
    // nothing else does...
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.