Skip to content

Instantly share code, notes, and snippets.

@akiniwa
Last active August 29, 2015 14:03
Show Gist options
  • Save akiniwa/dcee31e6ed17e95bd309 to your computer and use it in GitHub Desktop.
Save akiniwa/dcee31e6ed17e95bd309 to your computer and use it in GitHub Desktop.
// referenced from http://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html
public class Foo {}
public class Bar {
public Bar(Foo foo) {}
}
public class Foobar{
public Foobar(Bar bar) {}
}
public class FooProcessor implements ItemProcessor<Foo,Bar>{
public Bar process(Foo foo) throws Exception {
//Perform simple transformation, convert a Foo to a Bar
return new Bar(foo);
}
}
public class BarProcessor implements ItemProcessor<Bar,FooBar>{
public FooBar process(Bar bar) throws Exception {
return new Foobar(bar);
}
}
public class FoobarWriter implements ItemWriter<FooBar>{
// write returns ?, which is returned from process.
public void write(List<? extends FooBar> items) throws Exception {
//write items
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment