Re: Access a private variable?
Re: Access a private variable?
- Subject: Re: Access a private variable?
- From: Sacha Mallais <email@hidden>
- Date: Thu, 14 Jul 2005 16:48:39 -0700
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:
This email sent to email@hidden