incubator-isis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Meyer - KMZ" <>
Subject Re: Problem with non-support of Collections as arguments.
Date Fri, 15 Jul 2011 09:36:14 GMT
Hi Iain,

On 15 Jul 2011 at 1:37, Iain Flynn wrote:

> On 14 Jul 2011, at 11:23, Kevin Meyer - KMZ wrote:
> > 
> > Look at dishevelled:
> >
> > 

> Done some experimenting and I'm quite impressed! I've done some
> tinkering with one of the Mutable templates and I've managed to
> remove constructors from generated classes (I prefer using
> repositories, and it likes to throw Collections in as parameters)
> and have Collections be eagerly initialised, preventing the
> possibility of null pointers. 

Sure - the template based mechanism seems to imply that it'll be 
highly configurable. 

> I do have a couple of concerns (can't see a way to declare a class
> as abstract, no support for adding your own methods without them
> getting overwritten upon re-generation) but I'm liking this so far
> and will definitely bring it up with my supervisor when we meet
> early next week. 

For abstract support, I presume you should easily be able to either 
extend dishevelled's source to support "abstract" as a class type 
modifier, or just edit the class templates, or both.

For losing changes with regeneration, one of the code-generators that 
I was readin about yesterday supported the concept of "user comment 
blocks" that bracketed user-code. If a user comment block was 
present, it'd preserve code between the open and close markers when 
it regenerated the code.

Otherwise, you just add your user code to an extended (sub?)class of 
the generated code: 
Class UserExtensions extends GeneratedBase {
  public boolean hideCustomer(){

where GeneratedBase is the generated code and has the Customer 
property (with getters/setters, etc).

> As for advantages, I think adding in referential integrity to
> associates (using the mutual registration pattern) and implementing
> a way to add validate methods to operations could be useful for
> generating classes for Isis, and I believe both should be doable. 

This reminds me: I have an open JIRA ticket for modifying the Isis 
Eclipse templates regarding the mutual registration pattern [1].

If you're planning on actually implementing a full parent/child mutual 
registration pattern, please let me know how you do so. The current 
Isis Eclipse code templates are, AFAIAC, broken (see [1]) - but I've not 
proposed a fix as I have not used a child collection that retains a copy 
of the parent, or deferred to the parent for addition/deletion.

I'll patch the templates as required for your purposes.

> Thank you so much for introducing me to this!

You're welcome.  

For what it's worth, I did find a few other tools that supported code 
generation from UML (e.g. ArgoUML [with Eclipse plugin], etc), but I 
assumed you wanted to keep to a text-based solution.



View raw message