On 10/2/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> void antMixin(RegexMixin x) { >> this.regexParams = x; >> } > >That would be *fantastic* Peter!!!
It would be nice to have. I have no code but suspect that IH would hit new Complexity Limits.
>Overlap in attr/elem between the main type and the mixins >would be silently ignored (maybe a warning a warn or debug >level only), the main type taking precedence;
Hard to know what is the best approach -whine or ignore? but overlap in
>attr/elem between the mixins would be an error (ambiguous).
Yes. You could also pass the value to both: the task and the mixin. Mmm.. I do not think so - too much scope for bugs. public class MyMixin /* extends PC/some baseclass? */ { PC I think, to get location,and loging - just Object should work as well. private String foo;
public void setFoo(String f) { foo=f; } } public class MyTask extends Task /* maybe each ProjectComponent */ { MyMixin mixin; public void antMixin(MyMixin in) { mixin = in; } String foo; public void setFoo(String f) { foo=f; } } <mytask foo="bar"/> --> MyTask.foo = "bar" --> MyTask.mixin.foo = "bar" Another possibility would be setting the back reference automatically public class MyMixin { Task caller; public void setTask(Task c) { caller=c; } }
Or public void setContaining(ProjectComponent pc) ; Declation of mixin: I would rather have annotations: public class MyTask { @AntMixin private RegexParams regexParams; } but that will not happen so: void antMixin(RegexParams ..) will have to do for the moment. Note that antMixin will always be called, even if the no attributes or nested elements are set alternatively other naming convenetions could be used: private RegexParams antMixinRegexParams; or RegexParams getAntMixinXXX() (where XXX is ignored by IH, but can ge used to have multiple mixins). or Object[] getAntMixins() Peter