Java Mailing List Archive

http://www.junlu.com/

Home » FreeMarker-user »

Re: [FreeMarker-user]
 BeansWrapper.populateClassMapWithPropertyDescriptor failing
 to create property descriptors

Daniel Dekany

2011-11-16

Replies: Find Java Web Hosting

Author LoginPost Reply
Is it 100% sure that it doesn't break BC? Because then I backport this
into 2.3.x. Otherwise the users can't take advantage of it anyway,
since 2.4.x is not released.

--
Best regards,
Daniel Dekany


Tuesday, November 15, 2011, 9:07:33 PM, Attila Szegedi wrote:

> Ok, made the change on Github:
> <https://github.com/freemarker/freemarker/commit/f88a21323d5f9658728cc848152d5133444c2e63>.
> Donnchadh, you should be able to clone the repo and build from source simply by:
>
> git clone git://github.com/freemarker/freemarker.git
> cd freemarker
> ant jar
>
> the JAR file will be in build/freemarker.jar
>
> Attila.
>
> On Nov 15, 2011, at 10:48 AM, Newman, John W wrote:
>
> sounds great to me... I can't see any reason why that block would
> even need to bother with the write method .. just leave it as null
> and move on. Unless .. is anyone using beanswrapper to write
> properties? I hope not, but maybe.
>
> [#assign x = (bean.setY('z'))!"" /]
>
> ^ does that even work? If it does, it probably would even without
> messing with the write method as it's calling setY explicitly. I
> think the part in question with the write method is there to avoid
> writing "get" and "set", like ${bean.x.y}   = bean.getX().getY()
> ... but is it even possible to do a direct assignment to a field in FM? I don't think so... ?
>
> -----Original Message-----
> From: Donnchadh Ó Donnabháin [mailto:donnchadh@(protected)]
> Sent: Tuesday, November 15, 2011 13:34
> To: FreeMarker-user
> Subject: Re: [FreeMarker-user]
> BeansWrapper.populateClassMapWithPropertyDescriptor failing to create property descriptors
>
> Yes, that does seem like a much simpler solution.
>
> Donnchadh
>
> On 15 November 2011 17:56, Attila Szegedi <szegedia@(protected):
> Actually, I don't think we use write methods at all, do we?
> FreeMarker is only ever reading properties, never writing them. I'm
> not even sure why I wrote the code so that it's putting the write
> methods into the property descriptors; I guess we could just replace
> them with nulls and thus emulate read-only properties.
>
> Attila.
>
> On Nov 15, 2011, at 7:26 AM, Donnchadh Ó Donnabháin wrote:
> ...
>
> Maybe this code on line 1255 of BeansWrapper.java (FreeMarker 2.3.17):
>                pd = new PropertyDescriptor(pd.getName(),
>                     publicReadMethod,
> pd.getWriteMethod());
>
> could be replaced with something like this:
>
>                Method writeMethod = pd.getWriteMethod();
>                if (writeMethod != null &&
> (pd.getWriteMethod().getParameterTypes().length != 1
>                     ||
> pd.getWriteMethod().getParameterTypes()[0] !=
> publicReadMethod.getReturnType())) {
>                   writeMethod = null;
>                }
>                pd = new PropertyDescriptor(pd.getName(),
>                     publicReadMethod, writeMethod);
>
> What do you think?
>
>   Donnchadh
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> FreeMarker-user mailing list
> FreeMarker-user@(protected)
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> FreeMarker-user mailing list
> FreeMarker-user@(protected)
> https://lists.sourceforge.net/lists/listinfo/freemarker-user


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
FreeMarker-user mailing list
FreeMarker-user@(protected)
https://lists.sourceforge.net/lists/listinfo/freemarker-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.