Jack Woehr wrote:
Steve Loughran wrote:

Even if you could retro-fit every task out there with getters,
  -what about overloaded set operatons? which one should the get return?
-what about property assignments. Tasks get their setters with properties expanded.


Hmm. Ah, well. Writing out the project seems to be a fairly obvious functionality in comparison to some of the exotic functionality of Ant. I guess it's just one of those things which in hindsight the design should have accomodated, but which are difficult to retrofit given that the design
did not so accomodate.


thanks everyone for the discussion. it does seem like it'd be more difficult to add than i had understood, and probably there are not a littany of use cases, and mine is pretty easily addressed by direct DOM generation and serialization (thanks DOMElementWriter writer!) or, if i'm enterprising enough, a simple schema + jaxb for the ant subset i care about.

that being said, if it comes up again, here's an idea. define something like the following interface:

    public
    interface
    MarshallableProjectElement
    {
        public
        void
        marshalIntoNode(
            Node target,
            Document project
        ) throws BuildException;
    }

the 'project' parameter allows the implementor to do things like project.createElement().

in addition, there would be a helper class:

    public
    class
    ReflectiveMarshaller { ... }

which takes a project, creates a document element, and starts calling (recursively and with reflection) all getters which return a MarshallableProjectElement (or a collection thereof) and passing the results in to the given object's marshalIntoNode() method, and then serialize it somewhere.

this would seem to be retrofittable, and allow for gradual implementation where it makes sense.


fun, fun, fun...


jon

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to