groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miro Bezjak <bezjak.m...@gmail.com>
Subject Re: Groovy doesn't follow java beans specification on certain edge cases?
Date Fri, 29 May 2015 14:17:40 GMT
If by property name you mean: field name (not relevant in this case) +
getter name + setter name, then yes.

That is, for `cName`, groovy generates: `getcName` and `setcName`. But it
should (probably?) generate: `getCName` and `setCName`.

Regards,
Miro

On Fri, May 29, 2015 at 3:39 PM, Jochen Theodorou <blackdrag@gmx.org> wrote:

> Am 29.05.2015 15:32, schrieb Miro Bezjak:
> [...]
>
>> As far as I can see, this only affects java.beans. The following example
>> works without any problem:
>> --------------------------------------
>> class Foo {
>>      String cName
>> }
>>
>> def f = new Foo()
>> f.cName = 'abc'
>> println f.cName // abc
>> --------------------------------------
>>
>>
>> One workaround is to define proper getter and setter:
>> --------------------------------------
>> class Foo {
>>      String cName
>>
>>      String getCName() { cName }
>>      void setCName(String cName) { this.cName = cName }
>> }
>>
>> new java.beans.PropertyDescriptor('cName', Foo) // ok now
>> --------------------------------------
>>
>
> that would mean the isCName method missing is a false flag and really this
> is about capitalization of property names
>
> bye blackdrag
>
> --
> Jochen "blackdrag" Theodorou
> blog: http://blackdragsview.blogspot.com/
>
>

Mime
View raw message