What is event adapter class? When should we use an event adapter class?- It is a pattern which provides default implementation of interface or abstract class.
- Adapter class provides the default implementation of all the methods in an event listener interface.
- Usually adapter classes ease the programmers by providing the implementations of the listener interfaces instead of having to implement them. This is where the event adapter class comes into picture.
- These classes are useful when you want to process only few of the events that are handled by a particular event listener interface.
- Using adapters it helps to reduce the clutter in your code.
Advantages of the Adapter class:
- It increases the transparency of classes.
- It makes a class highly reusable.
- It provides a pluggable kit for developing application.
- It provides a way to include related patterns in a class.