Re: BeansWrapper.populateClassMapWithPropertyDescriptor failing to create property descriptors

Donnchadh Ó Donnabháin <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CADe7t4jYxv4u=wLXU9qwrQHnXjWgjxK+9HMpmhpkpgB=P4Q4qg@mail.gmail.com>
Yes, that does seem like a much simpler solution.

  Donnchadh

On 15 November 2011 17:56, Attila Szegedi <[email protected]> wrote:
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.