[stringtemplate-interest] StringTemplate type proxies
Nikolas Everett
nik9000 at gmail.com
Mon Dec 13 04:09:51 PST 2010
Displaytag uses a somewhat similar approach that is actually less powerful
then what you're suggesting. May I suggest only dipping to the proxy object
if the normal object doesn't have the field you are looking for? This would
cut down on the (generated) code inside the proxy objects at the cost of not
being able to use them for information hiding. Again, displaytag uses a
similar technique and I find it to be quite useful. Also, would it make
more sense to call these type decorators?
--Nik Everett
On Mon, Dec 13, 2010 at 12:18 AM, Terence Parr <parrt at cs.usfca.edu> wrote:
> So this is to prevent code pollution with stuff needed just for code gen?
> It makes some sense, though I'm wondering how I've handled this in the
> past. Probably I modify the model object to have the property.
>
> Would this registering type thing be confused with registering attribute
> renderers?
>
> Ter
>
> On Dec 12, 2010, at 7:40 PM, Sam Harwell wrote:
>
> I recently started using StringTemplate for a significant code generation
> project. I’m quite happy with the way things are progressing, but I’m
> noticing there are several times where I have to add a new property to my
> code objects just so StringTemplate can produce the desired output. In a
> manner similar to attribute renderers, I believe the addition of type
> proxies would be extremely beneficial. Suppose the user registers a type
> proxy for type T. The type proxy exposes the following method:
>
> object createProxy(object value);
>
> Whenever an attribute resolves to a value of type T, the proxy’s
> createProxy() method is called. Attributes on the object are resolved
> against the value returned by the proxy.
>
> Any thoughts on this?
>
> Thanks,
> Sam
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20101213/6b6652dd/attachment.html
More information about the stringtemplate-interest
mailing list