Niall Pemberton wrote the following on 9/16/2004 12:41 AM:

"I don't see how this is going to work though. The problem is I'm getting
back an Object (the FooBar one) from the back end that has the nested
collections inside. This isn't a Struts object (not of type ActionForm)."

I guess what meant was the object I'm dealing with is "handed" to me. It's not an object that I have that much control of since it's coming from the business layer (not coded by me) so not sure I can say "start implmenting lazyList stuff in there.



Hadn't really been following this thread, but isn't the trick to getting round the BeanUtils issue all in the getFooBar(index) method. I don't use LazyList, but if it was an array - wouldn't something like the following work

private FooBar[] fooBars;

public FooBar getFooBar(int index) {

The problem is there are not getXXX(int index) methods in the business objects. The initial post mentions I'm stuffing one object into my form:


class MyForm extends ActionForm {
   private FooBarValueObject fooBar;
   //get/set fooBar
}

FooBarValueObject has a few properties but the main one of interest being:
        Collection fooBars;

Which end up being Collections of other FooBarValueObjects.

It's not a big deal. I'm just going to use Session scope. If performance becomes an issue I'll work on some listner thing that Michael talked about that cleans it up. (I've actually yet run into a case where keepign stuff in a User's Session caused serious memory problems... then again I'm not working on Amazon.com or anything:)


if (fooBars == null) { fooBars = new FooBar[index]; }

    if (fooBars.length <= index) {
        FooBar[] newFooBars = new FooBar[index + 1];
        System.arraycopy(foobars, 0, newFooBars, 0, fooBars.length);
        fooBars = newFooBars;
    }

    if (fooBars[index] == null) {
        fooBars[index] = new FooBar();
    }

    return fooBars[index];

}

-- Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to