[stringtemplate-interest] Renderer "modes"

Terence Parr parrt at cs.usfca.edu
Mon Jun 19 11:44:43 PDT 2006


On Jun 19, 2006, at 11:34 AM, Jeremy Gray wrote:

> Ack. Sorry, we're not in a position to be subclassing dates to provide
> for alternate formatting.

Just wrap the dates in an object that delegates.  getMedium() would  
call the formatted on the wrapped object. :)

> In some cases, it is even the exact same
> DateTime instance being rendered two different ways. In any case, I
> can't/won't change the model. Is this not precisely the kind of usage
> that the renderer approach should be allowing us to address in a  
> manner
> transparent to the model?

No need for a renderer really...just wrap automatically by  
subclassing StringTemplate and having it auto-wrap all Dates. :)   
Works great.

Ter


More information about the stringtemplate-interest mailing list