File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Is this Adapter Pattern?? 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 "Is this Adapter Pattern??" Watch "Is this Adapter Pattern??" New topic
Author

Is this Adapter Pattern??

Smith Jone
Greenhorn

Joined: Nov 15, 2006
Posts: 11
My Program has Two interface(DBMain,DBClient);



AdapterDB is Adapter Class


Data(Data Access) is Adaptee Class



Because I must implement Sun supplied interface(DBMain),
So Data class implement DBMain. Make sence??

I must throws IOException in interface as DBClient-interface which declare IOException.It doesn't exist in Sun supplied interface(DBMain)
Because RemoteImplement class must declare RemoteException about Data methods.


Is this Object Adapter Pattern for Sloving these problems??


[Edited topic title. Believe me, nothing is "Important" on JavaRanch, unless we say so ]
[ November 21, 2006: Message edited by: Smith Jone ]
[ November 21, 2006: Message edited by: Barry Gaunt ]

SCJP 5.0<br />SCJD(In progressing!)<br />SCWCD(planing)<br />SCBCD(planing)
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
Yeah the adapter pattern is the best way around the interface problem and the way you are proposing to do it is correct.


SCJP<br />SCJD
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi,

in the AdapterDB class you can do :
1.Use DbMain instead of Data
2.If you decide to make the database static you can also make it final.

Regards M


SCJP, SCJD, SCWCD, OCPJBCD
 
jQuery in Action, 2nd edition
 
subject: Is this Adapter Pattern??
 
Similar Threads
NX:About DBMain interface
Beta Question: unlock
[URLyBirdHotel 1.3.3] Couldn't I use Data.java interface class?
[UB1.3.3] DBMain Question! Help me plz..
Do i have to create new exception for my interface