• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about the methode defined in the interface

 
Stef Widmer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic