Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Use of Adaptor Class while implementing interface

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 30-01-2011
Member
 
Join Date: May 2008
Posts: 248
Use of Adaptor Class while implementing interface
  

I think all the programming language including the object oriented language use the concept of implementing the interface , but in while implementing an interface , we sometime make use of the adapter class , i do not exactly know why we precisely make use of it , has anyone sort of idea what is the actual purpose of using this adapter class when you implement any interface . Please post back your valuable suggestions.

Reply With Quote
  #2  
Old 30-01-2011
Member
 
Join Date: May 2009
Posts: 520
Re: Use of Adaptor Class while implementing interface

Since we know that interface only includes the declaration of any method or methods in it , any that wants to access those methods will have to implement that particular interface in order to use that method. Then in that class the methods are defined that is code for their body is written .Previously I used to think that we have to define all the methods of that implemented interface and if I want to use only few methods , We may use the Adaptor class.
Reply With Quote
  #3  
Old 30-01-2011
Member
 
Join Date: May 2009
Posts: 609
Re: Use of Adaptor Class while implementing interface

An adapter is one of the typical design patterns. It is a class in Java as well that implements an interface with a collection of dummy methods. It lets you quickly implement an interface. It also enables your class carry on to work ever if the essential interface obtains new methods. You can then create a subclass the adapter class and override only the required methods you want. This is the actual use of the Adaptor class , I think you got my point. But in case if you have any doubts , you can post back and ask it .
Reply With Quote
  #4  
Old 30-01-2011
Member
 
Join Date: May 2009
Posts: 500
Re: Use of Adaptor Class while implementing interface

An adapter is one of the typical design patterns. It is a class in Java as well that implements an interface with a collection of dummy methods. It lets you quickly implement an interface. It also enables your class carry on to work ever if the essential interface obtains new methods. You can then create a subclass the adapter class and override only the required methods you want. This is the actual use of the Adaptor class , I think you got my point. But in case if you have any doubts , you can post back and ask it .
Reply With Quote
  #5  
Old 30-01-2011
Member
 
Join Date: May 2009
Posts: 531
Re: Use of Adaptor Class while implementing interface

In java programming language, adapter class is utilized toimplement an interface that has a group of dummy functions . A few event listener interfaces need several methods. For instance, WindowListener needs seven methods. usually, you only are concerned regarding one of these methods, windowClosing. If we were to code an nameless inner class to terminate an application, it may appear that he can override to the methods he requires.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Use of Adaptor Class while implementing interface"
Thread Thread Starter Forum Replies Last Post
Problem with abstract class and interface Vodka Software Development 5 08-03-2010 11:20 AM
Can I extend a java class or interface in a JSP page? Juaquine Software Development 4 17-02-2010 08:07 PM
Class, interface errors in my program Balamani Software Development 3 02-12-2009 05:26 PM
Abstract class and Interface in .net RogerFielden Software Development 3 04-05-2009 06:07 PM
What's the difference between an interface and an abstract class in JAVA? Vaibhav S Software Development 4 02-03-2009 07:46 PM


All times are GMT +5.5. The time now is 09:11 AM.