I might be stating the obvious here and it might be something you've already
solved, but in case you haven't…
I hit the case recently where I wanted to use an internal subclass as the field
type for a DSL object. This internal subclass had extra behaviour that wasn't
defined on the public type that was part of the getter signature for this
field. Something like…
private InternalThing thing = new InternalThing();
Thing getThing() {}
This is inherently unsafe in a convention mapping world. The user can…
task.conventionMapping.map("thing") { new Thing() { } }
In summary, you cannot use a different type for the field internally than what
is exposed in the getter.
The strategy I used to deal with this was to change the internal type to a
decorator.
private Thing thing = new DefaultThing();
Thing getThing() {}
@TaskAction
void doStuff() {
InternalThing internalThing = new InternalThing(getThing());
}
This worked in my case because the internal version added new behaviour and no
new state.
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email