Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-10 Thread Niall Pemberton
On Mon, Jun 7, 2010 at 5:18 PM, Dimitris Tsitses <4.biz@gmail.com> wrote: > Hi James, thanks for keeping up with my questions. > > So, you mean end up with something like this: ? > > public class MyBean { >       private ClassTypeA myProperty; >       private ClassTypeB myPropertyAsB; >       p

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-10 Thread Niall Pemberton
On Sun, Jun 6, 2010 at 5:55 PM, Dimitris Tsitses <4.biz@gmail.com> wrote: > myProperty is of one type only. The overloaded setters are there only for > convenience, i.e., to convert to the type of myProperty before setting it. I > don't think the JavaBeans spec disallows that, if it did, that

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-10 Thread Niall Pemberton
On Sun, Jun 6, 2010 at 3:02 AM, Dimitris Tsitses <4.biz@gmail.com> wrote: > Hi all, I'm trying to do something really simple but I can't seem to figure > it out, I hope someone can help. > > I have a simple bean: > > > public class MyBean { >        private ClassTypeA myProperty; > >        pu

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread James Carman
Create a helper method of your own somewhere? On Mon, Jun 7, 2010 at 5:28 PM, Dimitris Tsitses <4.biz@gmail.com> wrote: > Sorry, it appears that I didn't explain myself properly. What I mean is that > BeanUtils.setProperty() expects to receive the property name (i.e., > "customer"), whereas

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread Dimitris Tsitses
Sorry, it appears that I didn't explain myself properly. What I mean is that BeanUtils.setProperty() expects to receive the property name (i.e., "customer"), whereas MethodUtils.invokeMethod() expects to receive the method name (i.e., "setCustomer"). So I'm wondering what is the best way to reso

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread James Carman
On Mon, Jun 7, 2010 at 1:05 PM, Dimitris Tsitses <4.biz@gmail.com> wrote: > Hi James, > > actually replacing: > BeanUtils.setProperty(myBeanInst, myProperty, instanceOfClassTypeX); > > with: > MethodUtils.invokeMethod(myBeanInst, myPropertySetter, instanceOfClassTypeX); > > works like a dream,

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread Dimitris Tsitses
Hi James, actually replacing: BeanUtils.setProperty(myBeanInst, myProperty, instanceOfClassTypeX); with: MethodUtils.invokeMethod(myBeanInst, myPropertySetter, instanceOfClassTypeX); works like a dream, thanks for pointing out MethodUtils. I'm currently converting 'myProperty' to 'myPropertySet

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread James Carman
No, you wouldn't have the fields, just the methods that do the conversion to store/retrieve the values from the one, main, field. Also, I wouldn't consider this a "lack of basic functionality" on the part of BeanUtils (*many* folks use BeanUtils in their projects and haven't complained that this i

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread Dimitris Tsitses
Hi James, thanks for keeping up with my questions. So, you mean end up with something like this: ? public class MyBean { private ClassTypeA myProperty; private ClassTypeB myPropertyAsB; private ClassTypeC myPropertyAsC; private ClassTypeD myPropertyAsD; .

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread James Carman
it but JEXL2 just does that > (JexlEngine.{s,g}etProperterty). > Hope this can help, > Henri > -- > View this message in context: > http://apache-commons.680414.n4.nabble.com/beanutils-beanutils-library-cannot-invoke-the-correct-accessor-tp2244705p2245549.html > Sent fro

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread henrib
.680414.n4.nabble.com/beanutils-beanutils-library-cannot-invoke-the-correct-accessor-tp2244705p2245549.html Sent from the Commons - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-07 Thread James Carman
Why not have another "calculated" property ("myPropertyAsB") that can do the translation from ClassTypeB to/from ClassTypeA and store it into myProperty? That way, you don't have to modify the library at all? On Mon, Jun 7, 2010 at 12:04 AM, Dimitris Tsitses <4.biz@gmail.com> wrote: > Ok. I n

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-06 Thread Dimitris Tsitses
Ok. I need some help to hack the library, where do I start. I want to make it so that it checks the available setters against the objectType of the given argument, instead of assuming an argument of a specific type. Example: BeanUtils.setProperty(myBeanInst, "myProperty", instanceOfClassTypeX);

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-06 Thread James Carman
The property consists of the getter/setter, not some field. So, the pair of matching setter/getter are what makes up the property. The overloaded method isn't a setter for the property. On Sun, Jun 6, 2010 at 12:55 PM, Dimitris Tsitses <4.biz@gmail.com> wrote: > myProperty is of one type onl

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-06 Thread Dimitris Tsitses
myProperty is of one type only. The overloaded setters are there only for convenience, i.e., to convert to the type of myProperty before setting it. I don't think the JavaBeans spec disallows that, if it did, that would mean that the JavaBeans spec undermines Java's spec! (i.e., do you like meth

Re: [beanutils] beanutils library cannot invoke the correct accessor

2010-06-06 Thread James Carman
That violates the JavaBeans specification. "myProperty" is supposed to be of one type only. On Sat, Jun 5, 2010 at 10:02 PM, Dimitris Tsitses <4.biz@gmail.com> wrote: > Hi all, I'm trying to do something really simple but I can't seem to figure > it out, I hope someone can help. > > I have a

[beanutils] beanutils library cannot invoke the correct accessor

2010-06-05 Thread Dimitris Tsitses
Hi all, I'm trying to do something really simple but I can't seem to figure it out, I hope someone can help. I have a simple bean: public class MyBean { private ClassTypeA myProperty; public void setMyProperty(ClassTypeA anObj) { this.myProperty = anObj;