ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <adammurdoch...@yahoo.com>
Subject [patch] myrmidon configurer
Date Sat, 12 Jan 2002 23:42:43 GMT

Hi,

A couple of changes to the configurer in myrmidon:


* Handle references.

References can appear as either an attribute or a nested element of an
object:

As an attribute:

<javac classpath-ref="some-classpath">

As a nested element:

<javac>
    <classpath-ref id="some-classpath"/>
</javac>


* Unify attributes and elements at the task interface.

This patch changes the configurer so that the addX() and setX() methods have
the same semantics.  Each addX() or setX() method defines a property X,
which can appear as either an attribute x or as nested <x> elements (or
both).

There may also be createX() method, which is used to create the property
value to be configured.  A property with a createX() method may only appear
as a nested element.

A quick summary of how the configurer configures an object:

- For each attribute x-ref="id":
  - looks up the object using "id".
  - sets the value using setX()/addX().
  - this cannot be used if the object has a createX() method.

- For each attribute x="value":
  - resolves property references in the value.
  - converts the string value into the correct type.
  - sets the value using setX()/addX().
  - this cannot be used if the object has a createX() method.

- For each nested element <x-ref id="id"/>:
  - handled the same as attribute x-ref="id".

- For each nested element <x>:
  - creates the value using the createX() method (if present) or the no-args
constructor.
  - configures the value using the nested element.
  - sets the value using setX()/addX().

This is really only intended to be a temporary solution.  I'd like to go
through and standardise on either addX() or setX(), and possibly look at
doing away with the createX() method.  And there's plenty more stuff yet to
be implemented.


Adam

ps. Not sure how to show deleted files with cvs diff, so here are the files
that have been deleted/renamed:

AttributeSetter
DefaultAttributeSetter
ElementSetter
DefaultElementSetter

Mime
View raw message