• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Is this Adapter Pattern??

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah the adapter pattern is the best way around the interface problem and the way you are proposing to do it is correct.
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic