velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject introspection 'enhancement'
Date Thu, 01 Feb 2001 18:29:09 GMT
I added a small fix to the 'case sensitivity' of properties, as this was
recently discussed sort of :

If you have a method 

   getFoo() 

and in your template you do 

  $bar.foo 

we will try getfoo() first, and then getFoo() if getfoo() isn't found.

And in the interest of symmetry, we do the reverse.  If you are wierd,
and have a method

  getfoo()

and your designer has a clue :

  $bar.Foo

then we try getFoo() first, and then getfoo() second.

I am queasy a little about this, but even queasier about not having it,
and someone is going to ask for it anyway :)

Note that the best strategy for performance is to get it right, to limit
the amount of expensive introspection...

Note also that I believe this is an inversion of the bean spec, rather
than a literal reading.  As I read it, the bean spec talks about this
when dealing with naming a property that it finds a pair of matched
getter/setter methods.  We are going the other way, finding the
getter/setter methods given a property name.

(I will make set work the same way....)

geir


-- 
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Mime
View raw message