[stringtemplate-interest] StringTemplate type proxies

Rafael Chaves rafael at alphasimple.com
Tue Dec 14 11:28:45 PST 2010


Yup, renderers translate from whatever values to String. The decorator
(not a proxy, as it augments the shape of the target object) allows
obtaining the values.

This should apply at any level in the model graph, not only top level
attributes. Does setAttribute handle that?

For instance: Package has Classes with have Attributes. I set only one
attribute on the top-level template, to be the root package object,
and then navigate the graph with several templates (one for packages,
one for classes, and another for attributes).

Will overriding setAttribute allow me to intercept how any arbitrarily
deep object is handled?

Cheers,

Rafael

On Tue, Dec 14, 2010 at 11:16 AM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Very convincing argument, folks. thank you. 3rd party models.
>
> Ok, so how do they interact with renderers?  I guess the renderer is done *after* proxy stuff.
>
> Proxy: RandomModelObject -> MyWrapperForRandomModelObject, adds getFoo() or whatever.
>
> Then, if getFoo() returns type Date, renderer applies to that.  I like it.
>
> I remember mentioning how to do this manually. just override setAttribute() so that it traps RandomModelObject and wraps.
>
> Does this need to be formalized or can it simply be a FAQ entry?  it's a switch on type, look up in hashtable thing only right?
>
> Ter


More information about the stringtemplate-interest mailing list