[stringtemplate-interest] Primitives and Model Adapters

Collin Fagan collin.fagan at gmail.com
Fri Jan 28 13:44:23 PST 2011


Thank you :)

On Fri, Jan 28, 2011 at 2:28 PM, Terence Parr <parrt at cs.usfca.edu> wrote:

> hmm...easier/simpler to do this:
>
>    public void registerRenderer(Class attributeType, AttributeRenderer r) {
>                if ( attributeType.isPrimitive() ) {
>                        throw new IllegalArgumentException("can't register
> renderer for primitive type "+
>
>               attributeType.getSimpleName());
>                }
>        ...
>
> ter
>
> On Jan 28, 2011, at 11:15 AM, Collin Fagan wrote:
>
> > Not that I know of, I looked for a while and then wrote my own. It's a
> simple HashMap lookup, nothing fancy. Let me know and I can send it to you
> when I get home.
> >
> >
> > On Fri, Jan 28, 2011 at 12:10 PM, Terence Parr <parrt at cs.usfca.edu>
> wrote:
> >
> > On Jan 28, 2011, at 5:59 AM, Collin Fagan wrote:
> >
> > > I understand, no problem at all. In this case though can we do one of
> two things?
> > >
> > > 1. Throw an IllegalArgumentException when one tries to register a model
> adapter on a primitive.
> > > 2. Translate any primitive into it's boxed type during registration. ST
> already seems to treat return values of primitive types like boxed types
> when the template is run.
> >
> > is there a java method to convert int.class to Integer.class already?
> > Ter
> > _______________________________________________
> > 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/20110128/d9d7b0be/attachment.html 


More information about the stringtemplate-interest mailing list