LazyDynaBean in a pojo

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

LazyDynaBean in a pojo

Rémi Dewitte-2-3
Hi !
I use LazyDynaBean to gather results from the user. In my main LazyDynaBean,
I've elements which are subclasses of LazyDynaBean and theses elements can be
indexed (LazyDynaBean[]). I do this because I'm interested in lazy features
for indexed properties and mapped properties.

Now I'd like to pass this LazyDynaBean to a corresponding POJO.

I tried to create my LazyDynaForm like this :
public class LazyForm extends LazyValidatorForm {

        public LazyForm(){
                super((new WrapDynaBean(new PojoForm())));
        }
But interesting lazy features are lost...

An another way with BeanUtils.copyProperties();
For simple elements (String or even String[]), everything is good with
BeanUtils.copyProperties(pojo,lazybean). The problem is when I want to copy a
LazyElement to a PojoElement (inside the PojoForm) : how can I handle this.

How would you do this ?

Rémi

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[BeanUtils] Re: LazyDynaBean in a pojo

Rémi Dewitte-2-3
I wrote this method, can i have your comments for improvements ?

        public static void copyProperties(Object pojo, DynaBean bean)
                        throws IllegalAccessException, InvocationTargetException,
                        ClassNotFoundException, InstantiationException {
                DynaProperty[] dynaProperties = bean.getDynaClass().getDynaProperties();
                for (DynaProperty d : dynaProperties) {
                        Object value = bean.get(d.getName());
                        Class type = d.getType();
                        Class c;

                        if (d.isIndexed())
                                c = type.getComponentType();
                        else
                                c = type;

                        // c'est un dynaBean
                        if (DynaBean.class.isAssignableFrom(c)) {
                                String pojoName = c.getName().replaceFirst("Lazy", "dao.Pojo");
                                if (d.getType().isArray()) {
                                        Object[] objs = (Object[])
Array.newInstance(Class.forName(pojoName),Array.getLength(value));
                                        for(int i =0 ; i<objs.length;i++){
                                                objs[i] = Class.forName(pojoName).newInstance();
                                                copyProperties(objs[i], (DynaBean) Array.get(value,i));
                                        }
                                        BeanUtils.copyProperty(pojo, d.getName(), objs);
                                } else {
                                        Object in = Class.forName(pojoName).newInstance();
                                        copyProperties(in, (DynaBean) value);
                                        BeanUtils.copyProperty(pojo, d.getName(), in);
                                }
                                // copie simple
                        } else {
                                BeanUtils.copyProperty(pojo, d.getName(), value);
                        }
                }
        }

Rémi
Le Mardi 19 Juillet 2005 18:27, Dewitte Rémi a écrit :

> Hi !
> I use LazyDynaBean to gather results from the user. In my main
> LazyDynaBean, I've elements which are subclasses of LazyDynaBean and theses
> elements can be indexed (LazyDynaBean[]). I do this because I'm interested
> in lazy features for indexed properties and mapped properties.
>
> Now I'd like to pass this LazyDynaBean to a corresponding POJO.
>
> I tried to create my LazyDynaForm like this :
> public class LazyForm extends LazyValidatorForm {
>
> public LazyForm(){
> super((new WrapDynaBean(new PojoForm())));
> }
> But interesting lazy features are lost...
>
> An another way with BeanUtils.copyProperties();
> For simple elements (String or even String[]), everything is good with
> BeanUtils.copyProperties(pojo,lazybean). The problem is when I want to copy
> a LazyElement to a PojoElement (inside the PojoForm) : how can I handle
> this.
>
> How would you do this ?
>
> Rémi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [BeanUtils] Re: LazyDynaBean in a pojo

Simon Kitching
On Tue, 2005-07-19 at 19:48 +0200, Dewitte R�mi wrote:
> I wrote this method, can i have your comments for improvements ?

Hi Remi,

Unfortunately, BeanUtils is basically unmaintained. You are unlikely to
get any feedback on suggestions or patches for BeanUtils.

I suggest that you create a bugzilla entry and attach your proposed code
in case beanutils maintenance restarts in the future - but don't depend
on it.

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [BeanUtils] Re: LazyDynaBean in a pojo

sabernar
In reply to this post by Rémi Dewitte-2-3
Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  Or is it being left to stagnate for a reason (i.e. Java 5).

-Shawn

-----Original Message-----
From: Simon Kitching [mailto:[hidden email]]
Sent: Wednesday, July 20, 2005 1:51 AM
To: Jakarta Commons Users List
Subject: Re: [BeanUtils] Re: LazyDynaBean in a pojo


On Tue, 2005-07-19 at 19:48 +0200, Dewitte Rémi wrote:
> I wrote this method, can i have your comments for improvements ?

Hi Remi,

Unfortunately, BeanUtils is basically unmaintained. You are unlikely to
get any feedback on suggestions or patches for BeanUtils.

I suggest that you create a bugzilla entry and attach your proposed code
in case beanutils maintenance restarts in the future - but don't depend
on it.

Regards,

Simon



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [BeanUtils] Re: LazyDynaBean in a pojo

Simon Kitching
On Wed, 2005-07-20 at 09:45 -0400, Bernard, Shawn wrote:
> Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  
> Or is it being left to stagnate for a reason (i.e. Java 5).

There just doesn't appear to be any existing jakarta committers
interested in working on it.

I did try to restart interest in it, at least to deal with the large
number of bugzilla entries filed against beanutils but couldn't find
anyone willing to commit a few hours a week to work with me. As it's
pretty dangerous to work alone on this kind of library used by quite a
few other projects (as well as being pretty unrewarding) I've stopped -
and there isn't anyone else.

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Unmaintained projects

sabernar
In reply to this post by Rémi Dewitte-2-3
I never got an answer to my below question, and I just saw the question about one of the Sandbox projects.  Is there a list of unmaintained/abandoned Commons projects?  Is there anything that this community can do about them?  

-Shawn


-----Original Message-----
From: Bernard, Shawn [mailto:[hidden email]]
Sent: Wednesday, July 20, 2005 9:46 AM
To: Jakarta Commons Users List; [hidden email]
Subject: RE: [BeanUtils] Re: LazyDynaBean in a pojo


Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  Or is it being left to stagnate for a reason (i.e. Java 5).

-Shawn
Reply | Threaded
Open this post in threaded view
|

[beanutils] Unmaintained? was Re: Unmaintained projects

Dion Gillard-2
Why do you assume that BeanUtils is unmaintained?

On 7/22/05, Bernard, Shawn <[hidden email]> wrote:

> I never got an answer to my below question, and I just saw the question about one of the Sandbox projects.  Is there a list of unmaintained/abandoned Commons projects?  Is there anything that this community can do about them?
>
> -Shawn
>
>
> -----Original Message-----
> From: Bernard, Shawn [mailto:[hidden email]]
> Sent: Wednesday, July 20, 2005 9:46 AM
> To: Jakarta Commons Users List; [hidden email]
> Subject: RE: [BeanUtils] Re: LazyDynaBean in a pojo
>
>
> Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  Or is it being left to stagnate for a reason (i.e. Java 5).
>
> -Shawn
>


--
http://www.multitask.com.au/people/dion/
"You are going to let the fear of poverty govern your life and your
reward will be that you will eat, but you will not live." - George
Bernard Shaw

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [beanutils] Unmaintained? was Re: Unmaintained projects

Simon Kitching
[AARGH -- I hate top-posting!]

Shawn (correctly) assumes BeanUtils is unmaintained because I said so. A
couple of months ago I saw that the bugzilla count on beanutils was over
80, and so I put out a request for people to help me get this addressed.
I got two offers of assistance: not a lot, but enough so I got stuck in.
However the two volunteers quickly vanished. I certainly didn't want to
be working on beanutils on my own so I have now stopped too.

There are currently 82 bugzilla entries for beanutils, and no-one other
than myself has committed a patch for many months now.

That definitely qualifies as unmaintained.

Shawn: I did reply to your question:
  http://marc.theaimsgroup.com/?t=112178827000001&r=1&w=2

Regards,

Simon

--
A. Because it breaks the logical sequence of discussion
Q. Why is top posting bad?

On Fri, 2005-07-22 at 10:28 +1000, Dion Gillard wrote:

> Why do you assume that BeanUtils is unmaintained?
>
> On 7/22/05, Bernard, Shawn <[hidden email]> wrote:
> > I never got an answer to my below question, and I just saw the question about one of the Sandbox projects.  Is there a list of unmaintained/abandoned Commons projects?  Is there anything that this community can do about them?
> >
> > -Shawn
> >
> >
> > -----Original Message-----
> > From: Bernard, Shawn [mailto:[hidden email]]
> > Sent: Wednesday, July 20, 2005 9:46 AM
> > To: Jakarta Commons Users List; [hidden email]
> > Subject: RE: [BeanUtils] Re: LazyDynaBean in a pojo
> >
> >
> > Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  Or is it being left to stagnate for a reason (i.e. Java 5).
> >
> > -Shawn
> >
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [beanutils] Unmaintained? was Re: Unmaintained projects

Dion Gillard-2
Fair enough.

Once I get some spare personal time, I'll jump in and see if I can help.

On 7/22/05, Simon Kitching <[hidden email]> wrote:

> [AARGH -- I hate top-posting!]
>
> Shawn (correctly) assumes BeanUtils is unmaintained because I said so. A
> couple of months ago I saw that the bugzilla count on beanutils was over
> 80, and so I put out a request for people to help me get this addressed.
> I got two offers of assistance: not a lot, but enough so I got stuck in.
> However the two volunteers quickly vanished. I certainly didn't want to
> be working on beanutils on my own so I have now stopped too.
>
> There are currently 82 bugzilla entries for beanutils, and no-one other
> than myself has committed a patch for many months now.
>
> That definitely qualifies as unmaintained.
>
> Shawn: I did reply to your question:
>   http://marc.theaimsgroup.com/?t=112178827000001&r=1&w=2
>
> Regards,
>
> Simon
>
> --
> A. Because it breaks the logical sequence of discussion
> Q. Why is top posting bad?
>
> On Fri, 2005-07-22 at 10:28 +1000, Dion Gillard wrote:
> > Why do you assume that BeanUtils is unmaintained?
> >
> > On 7/22/05, Bernard, Shawn <[hidden email]> wrote:
> > > I never got an answer to my below question, and I just saw the question about one of the Sandbox projects.  Is there a list of unmaintained/abandoned Commons projects?  Is there anything that this community can do about them?
> > >
> > > -Shawn
> > >
> > >
> > > -----Original Message-----
> > > From: Bernard, Shawn [mailto:[hidden email]]
> > > Sent: Wednesday, July 20, 2005 9:46 AM
> > > To: Jakarta Commons Users List; [hidden email]
> > > Subject: RE: [BeanUtils] Re: LazyDynaBean in a pojo
> > >
> > >
> > > Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  Or is it being left to stagnate for a reason (i.e. Java 5).
> > >
> > > -Shawn
> > >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
http://www.multitask.com.au/people/dion/
"You are going to let the fear of poverty govern your life and your
reward will be that you will eat, but you will not live." - George
Bernard Shaw

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [beanutils] Unmaintained?

Simon Kitching
If you do, you might want to start with these issues:
 * 23815 [setNestedProperty] -- awaiting Niall's approval
 * 34457 [DynaProperty] -- awaiting comment [prob. from Niall]
 * 33841 [FloatLocaleConverter] -- awaiting comments
 * 33698 [double array support in StringArrayConverter] -- awaiting
feedback
 * 33461 [BeanUtilsBean.describe with private class] -- awaiting
feedback

Regards,

Simon

On Fri, 2005-07-22 at 10:45 +1000, Dion Gillard wrote:

> Fair enough.
>
> Once I get some spare personal time, I'll jump in and see if I can help.
>
> On 7/22/05, Simon Kitching <[hidden email]> wrote:
> > [AARGH -- I hate top-posting!]
> >
> > Shawn (correctly) assumes BeanUtils is unmaintained because I said so. A
> > couple of months ago I saw that the bugzilla count on beanutils was over
> > 80, and so I put out a request for people to help me get this addressed.
> > I got two offers of assistance: not a lot, but enough so I got stuck in.
> > However the two volunteers quickly vanished. I certainly didn't want to
> > be working on beanutils on my own so I have now stopped too.
> >
> > There are currently 82 bugzilla entries for beanutils, and no-one other
> > than myself has committed a patch for many months now.
> >
> > That definitely qualifies as unmaintained.
> >
> > Shawn: I did reply to your question:
> >   http://marc.theaimsgroup.com/?t=112178827000001&r=1&w=2
> >
> > Regards,
> >
> > Simon
> >
> > --
> > A. Because it breaks the logical sequence of discussion
> > Q. Why is top posting bad?
> >
> > On Fri, 2005-07-22 at 10:28 +1000, Dion Gillard wrote:
> > > Why do you assume that BeanUtils is unmaintained?
> > >
> > > On 7/22/05, Bernard, Shawn <[hidden email]> wrote:
> > > > I never got an answer to my below question, and I just saw the question about one of the Sandbox projects.  Is there a list of unmaintained/abandoned Commons projects?  Is there anything that this community can do about them?
> > > >
> > > > -Shawn
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Bernard, Shawn [mailto:[hidden email]]
> > > > Sent: Wednesday, July 20, 2005 9:46 AM
> > > > To: Jakarta Commons Users List; [hidden email]
> > > > Subject: RE: [BeanUtils] Re: LazyDynaBean in a pojo
> > > >
> > > >
> > > > Is there any reason why BeanUtils is unmaintained?  Is it just waiting for a maintainer?  Or is it being left to stagnate for a reason (i.e. Java 5).
> > > >
> > > > -Shawn
> > > >
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Unmaintained projects

robert burrell donkin
In reply to this post by sabernar
On Thu, 2005-07-21 at 17:04 -0400, Bernard, Shawn wrote:
> I never got an answer to my below question, and I just saw the question about one of the Sandbox projects.
> Is there a list of unmaintained/abandoned Commons projects?  

commons operates a hive approach: there are no specific maintainers, the
community of committers is responsible. of course, for each component,
there are a number of committers who've done work on that component.
some components are now mature which means committers tend to drift
away. IMHO this is pretty much the case with beanutils.

the issue of dead components in the sandbox is clear and different and
has been discussed at apachecon and i'll propose something (unless
someone beats me to it).

i'm not too sure how easy is to deal with the case of mature commons
components.

> Is there anything that this community can do about them?

good question :)

if there are no committers who have the energy to address the problems
of a component to their satisfaction, then this makes it impossible to
add new committers. if the developer and user community is still strong
(but is just lacking in committers willing to push the component
forward) then one option would be to build a son-of-beanutils elsewhere
(perhaps sourceforge) using the apache license and (perhaps) one day
(once a healthy community has developed) look to come back into the
commons through the incubator.

> -Shawn
>
>
> -----Original Message-----
> From: Bernard, Shawn [mailto:[hidden email]]
> Sent: Wednesday, July 20, 2005 9:46 AM
> To: Jakarta Commons Users List; [hidden email]
> Subject: RE: [BeanUtils] Re: LazyDynaBean in a pojo
>
>
> Is there any reason why BeanUtils is unmaintained?  
> Is it just waiting for a maintainer?  

see above

> Or is it being left to stagnate for a reason (i.e. Java 5).

i can only speak for myself. i have to hold down a day job and only have
a limited energy available for open source coding. beanutils now comes
pretty low on my priority list and so it's very unlikely that i'll ever
get round to working on it again any time soon.

i think that beanutils works ok but know that a significant amount of
effort would be needed to improve it without breaking compatibility.

i do think that a next generation beanutils is not only possible but
would be a good thing. however, the energy required would be significant
and it would have to start from a clean sheet. i have other interests
and aims which i think are more important and i'm not longer willing to
argue and patch something which has probably been pushed as far as it
can.

other folks may give different answers.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]