|[Xtend2] Builder Pattern: Cross References [message #757885]
||Fri, 18 November 2011 12:26
| Hauke Fuhrmann
Registered: July 2009
I love the new Xtend2 Builder Pattern that you can use since the new
Closure syntax in Xtend as presented by Sven
This allows to create containment trees of elements very elegantly like
Sven shows in the HTML example.
Is there a good solution how to integrate cross references between the
elements also beautifully? I only came up with something like this:
where the connect function uses eContainer to search the containment
hierarchy for nodes with the corresponding names. This seems to be
rather brittle as it will notice only at runtime that a corresponding
element is not there.
As crossreferences may be a very common case, maybe there is a generic
solution to that? Maybe like giving results of the closures a name or
something such that you can address closure elements from other
elements? Hmm... dunno, seems to not match the idea of a closure. Any ideas?
Powered by FUDForum
. Page generated in 0.01692 seconds