Re: Access a private variable?
Re: Access a private variable?
- Subject: Re: Access a private variable?
- From: Robert Walker <email@hidden>
- Date: Fri, 15 Jul 2005 09:34:31 -0400
displayGroup.setNumberOfObjectsPerBatch(0);
displayGroup.displayedObjects().count() 60 (the
number of qualified objects -- this is what I want)
That seems like a bug to me. Maybe that's why I still don't use
display groups. :-)
From my interpretation of the documentation on WODisplayGroup this
does not sound like a bug to me. The method displayGroup.allObjects
() contains an array of objects fetched into the display group.
There are a few methods that can change the collection, but
qualifyDisplayGroup() is not one of them. The method
qualifyDisplayGroup() does an "in-memory" filter of the allObjects
collection, so reporting from allObjects() still contains all objects
fetched. Using qualifyDisplayGroup() with a different qualifier
still needs access to the fetched collection since it does not fetch
from the data source.
If you use qualifyDataSource() instead of qualifyDisplayGroup() a
fetch does occur and allObjects() will receive a newly qualified
collection.
On Jul 14, 2005, at 7:48 PM, Sacha Mallais wrote:
On Jul 14, 2005, at 3:57 PM, Alex Johnson wrote:
Hi again --
On Jul 14, 2005, at 5:12 PM, Sacha Mallais wrote:
WODisplayGroup.allObjects().count();
On Jul 14, 2005, at 5:17 PM, Ricardo Strausz wrote:
Isn't it displayGroup.allObjects().count()??
Wow, thank you both for replying so quickly!
Let me add some more context to better explain my issue:
Starting with a WODisplayGroup that is initialized via the WOO
file, I call:
displayGroup.fetch();
This fetches about 350 objects from the database. In order to make
the results more user friendly, I set numberOfObjectsPerBatch to
25 for my display group:
displayGroup.setNumberOfObjectsPerBatch( 25 );
When I then call:
displayGroup.queryMin().takeValueForKey
( someTimestampInThePast, "dateCreated" );
displayGroup.qualifyDisplayGroup();
This trims down the list of objects to 60 objects (which makes 3
batches). I would like to display that number (60) somewhere on my
page. However, these are the results I get:
displayGroup.allObjects().count() 350 (the total
number of fetched objects)
displayGroup.displayedObjects().count() 25 (the
number that fit on that page), or 10 (for the last page)
displayGroup.setNumberOfObjectsPerBatch(0);
displayGroup.displayedObjects().count() 60 (the
number of qualified objects -- this is what I want)
That seems like a bug to me. Maybe that's why I still don't use
display groups. :-)
I would like to be able to get the third value without temporarily
setting numberOfObjectsPerBatch to 0, because that has the side
effect of erasing the selectedObjects() and currentBatchIndex().
Thus, I am wondering if it's possible for me to access the
WODisplayGroup's private variables to see if I can directly get
the array of qualified objects.
On Jul 14, 2005, at 5:12 PM, Sacha Mallais wrote:
Does anyone know if it's possible to access an object's private
variable?
Yes, it is.
Any sample code you can point me to?
No, but it is straightforward: create a java.lang.reflect.Field and
call setAccessible(true) and get() on it.
sacha
--
Sacha Michel Mallais - 400 lb. chimp
Global Village Consulting Inc.: http://www.global-village.net/
Choke on that, causality! -- the Professor, "Futurama"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden