You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by kennardconsulting <ri...@kennardconsulting.com> on 2009/01/03 00:13:36 UTC

[BeanUtils] Possible to hook in a different getter/setter naming convention?

Dear All,

I am enjoying using Commons BeanUtils with all its converters and
'foo.bar.baz' path notation goodness.

I was wondering if it was possible to retain this goodness whilst changing
to a different getter/setter naming convention? Instead of 'getFoo()',
'setFoo(x)', I'd like to use 'foo()' and 'foo_$eq(x)' which is the native
Scala naming convention.

Is there some method/interface to override to make this change without
impacting everything else?

Regards,

Richard.
-- 
View this message in context: http://www.nabble.com/-BeanUtils--Possible-to-hook-in-a-different-getter-setter-naming-convention--tp21259922p21259922.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [BeanUtils] Possible to hook in a different getter/setter naming convention?

Posted by kennardconsulting <ri...@kennardconsulting.com>.
Michael,

Thanks for the reply.

Yes, we already support the @BeanInfo approach. I was just looking to extend
this to 'native' Scala properties so that Scala authors didn't have to
'clutter' their domain objects with @BeanInfo annotations.

Anyway, it seems to be working now and is in SVN.

Thanks again,

Richard.

-- 
View this message in context: http://www.nabble.com/-BeanUtils--Possible-to-hook-in-a-different-getter-setter-naming-convention--tp21259922p21592568.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [BeanUtils] Possible to hook in a different getter/setter naming convention?

Posted by Michael Nascimento <mi...@gmail.com>.
On Fri, Jan 2, 2009 at 8:13 PM, kennardconsulting
<ri...@kennardconsulting.com> wrote:
> I was wondering if it was possible to retain this goodness whilst changing
> to a different getter/setter naming convention? Instead of 'getFoo()',
> 'setFoo(x)', I'd like to use 'foo()' and 'foo_$eq(x)' which is the native
> Scala naming convention.

Why not annotating your Scala classes with @scala.reflect.BeanInfo so
a proper BeanInfo gets generated?

Regards,
Michael Nascimento Santos
https://genesis.dev.java.net/
https://jsr-310.dev.java.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [BeanUtils] Possible to hook in a different getter/setter naming convention?

Posted by kennardconsulting <ri...@kennardconsulting.com>.
Okay, thanks Niall. Will do.

Regards,

Richard.
-- 
View this message in context: http://www.nabble.com/-BeanUtils--Possible-to-hook-in-a-different-getter-setter-naming-convention--tp21259922p21284097.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [BeanUtils] Possible to hook in a different getter/setter naming convention?

Posted by Niall Pemberton <ni...@gmail.com>.
On Fri, Jan 2, 2009 at 11:13 PM, kennardconsulting
<ri...@kennardconsulting.com> wrote:
>
> Dear All,
>
> I am enjoying using Commons BeanUtils with all its converters and
> 'foo.bar.baz' path notation goodness.
>
> I was wondering if it was possible to retain this goodness whilst changing
> to a different getter/setter naming convention? Instead of 'getFoo()',
> 'setFoo(x)', I'd like to use 'foo()' and 'foo_$eq(x)' which is the native
> Scala naming convention.

BeanUtils uses Introspector[1] at its heart[2] to discover the
properties of a bean - which is based on the java bean spec and tied
to the get/set naming convention for methods. So if you want to change
this behaviour you would need to start by overriding the
getPropertyDescriptors() method in PropertyUtilsBean

Niall

[1] http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Introspector.html
[2] http://commons.apache.org/beanutils/xref/org/apache/commons/beanutils/PropertyUtilsBean.html#956


> Is there some method/interface to override to make this change without
> impacting everything else?
>
> Regards,
>
> Richard.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org