File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about the methode defined in the interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question about the methode defined in the interface" Watch "Question about the methode defined in the interface" New topic

Question about the methode defined in the interface

Stef Widmer

Joined: Jun 16, 2004
Posts: 17
Hi,I've got a qustion about the methodes in the DBMain interface.
There is a methode "find" which returns an array of integers (the record keys) and a methode called "read" which takes one record key and returns an array of strings if the record cound be found. But there is no methode like "getAllRecords" or so.
When a client starts, I wanted to read all records from the db file display theme in the client's JTable. But for that the client needs to call the "find" methode without any argument first and then calls for each key returned the "read" methode. This seems to me as a big overhead.
But my assignment tells me, that I have to implement the DBMain interface in a class called "Data". For exchangeability I assume I should not extend the data class with public methodes I've designed (e.g. getAllRecords).
What do you think about this?
Thanks for any help

Stef Widmer
[ June 16, 2004: Message edited by: Stef Widmer ]
Omar Kalaldeh
Ranch Hand

Joined: Jun 08, 2004
Posts: 58

As I see it you have to choices:
1-Use the Adapter design pattern, where you can put your getAllRecords method in your adapter class.

2-Extends the DBMain interface and add to it the method getAllRecords, and implements that Extended interface.

See this thread for more information about extending DBMain interface

Big Moose Saloon

I hope this answer will help you.

Best Regards <br /> <br />Omar F. Kalaldah<br />---------------------<br />SCJP, SCJD, SCBCD
I agree. Here's the link:
subject: Question about the methode defined in the interface
It's not a secret anymore!