Jesse Glick <[EMAIL PROTECTED]> wrote:
> Ideally I would like to be able to use a simple interface akin to
> IntrospectionHelper, e.g.:
>
> public void execute() throws BuildException {
> IndirectTask t = project.createTaskIndirectly("zip");
> t.set("whenempty", "ignore");
> t.set("zipfile", "${foo}/foo.zip");
> IndirectElement e = t.create("fileset");
> e.set("dir", "src");
> // one step to configure it, initialize,
> // set location & parent, & execute:
> t.execute(this);
> }
>
> So that the code only relies on the XML-like structure of the tasks,
> not the Java-level API.
This should already be possible using IntrospectionHelper, something
like
Task t = project.createTask("zip");
IntrospectionHelper ih = IntrospectionHelper.getHelper(t.getClass());
ih.setAttribute(project, t, "whenempty", "ignore");
ih.setAttribute(project, t, "zipfile",
ProjectHelper.replaceProperties(project,
"${foo}/foo.zip",
project.getProperties());
Object fileset = ih.createElement(t, "fileset");
IntrospectionHelper ih2 = IntrospectionHelper.getHelper(fileset.getClass());
ih2.setAttribute(project, fileset, "dir", "src");
t.execute();
should work.
This is just saying, that it is possible right now, not that some
syntactic sugar like IndirectTask or IndirectElement wouldn't be nice.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]