-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How would you implement getBuyNows() in the Bid example?
PostPosted: Sat Oct 30, 2004 12:37 pm 
Newbie

Joined: Mon Nov 03, 2003 1:07 am
Posts: 14
The BuyNow object is a subclass of the Bid object in the Bid example

Once can easily call bidder.getBids() to obtain all the bids for that bidder, but how would one view JUST the bids that were made using the "BuyNow" feature?

My only idea on how to do this is to iterate through the collection (returned by getBids) and doing an instanceof on each of the "Bids" to see if it is a BuyNow class. I haven't tested to see if this works or not.

I was wondering if someone else would have a better approach to this problem.

I am using subclasses for 4 different subclasses, and need to tell them apart programmatically so that I can cast them and do my java magic.


Thanks.
Phillip


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.