[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-cocoon-dev
Subject: question regarding chainability of methods current API
From: "Robby Pelssers" <robby.pelssers () ciber ! com>
Date: 2011-07-06 8:46:32
Message-ID: 7C655C04B6F59643A1EF66056C0E095EA99D06 () eusex01 ! sweden ! ecsoft
[Download RAW message or body]
Hi Simone,
I have one question to the current interface of Pipeline. I know you wrote a \
SAXPipelineBuilder to allow chaining.
But it would have been much nicer if the Pipeline interface itself would have been \
chainable.
void addComponent(T pipelineComponent); --> Pipeline<T> addComponent(T \
pipelineComponent);
void setup(OutputStream outputStream); --> Pipeline<T> setup)(OutputStream \
outputStream);
Same for other methods for which it makes sense to chain them.
This would allow me to switch from
@Test
public void testXQuery1() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("sentence", "split words test");
XQJGenerator generator = new \
XQJGenerator(this.getClass().getResource("/xquery/stringtest.xquery")); \
generator.setXQDataSource(xqds);
Pipeline<SAXPipelineComponent> pipeline = new \
NonCachingPipeline<SAXPipelineComponent>(); pipeline.addComponent(generator);
pipeline.addComponent(new XMLSerializer().setIndent(true));
pipeline.setup(System.out, parameters);
pipeline.execute();
}
to
@Test
public void testXQuery1() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("sentence", "split words test");
XQJGenerator generator = new \
XQJGenerator(this.getClass().getResource("/xquery/stringtest.xquery")); \
generator.setXQDataSource(xqds); Pipeline<SAXPipelineComponent> pipeline =
new NonCachingPipeline<SAXPipelineComponent>()
.addComponent(generator)
.addComponent(new XMLSerializer().setIndent(true))
.setup(System.out, parameters)
.execute();
}
which basically is what you intended to achieve if i'm correct.
I know it's quite a big API change but designing the API with chainability in mind \
makes sense.
Robby
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic