Java Mailing List Archive

http://www.junlu.com/

Home » FreeMarker-user »

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

Donnchadh Ó Donnabháin

2011-11-15

Replies: Find Java Web Hosting

Author LoginPost Reply
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
©2008 junlu.com - Jax Systems, LLC, U.S.A.