velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fahrmeyer" <thomas.fahrme...@einsurance.de>
Subject AW: introspection 'enhancement'
Date Fri, 02 Feb 2001 08:34:54 GMT
Hi,

I asked for that ;)

It's a very flexible approach, but is it not too complicate ? The Bean spec
says that after a "get" or "set" (in a method name) must follow a uppercase
letter. So expect that a method in this signature is defined. And now just
convert the first letter of every property to uppercase and lool up the
method.

I think that makes the designer life easier and the programmer knows what he
have to do anyway (mostly) ;)

It's just very nice to write $user.name instead of $user.Name

Thomas


> -----Ursprungliche Nachricht-----
> Von: gmj@optonline.net [mailto:gmj@optonline.net]Im Auftrag von Geir
> Magnusson Jr.
> Gesendet: Donnerstag, 1. Februar 2001 19:29
> An: velocity-dev; velocity-user
> Betreff: introspection 'enhancement'
>
>
> 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