Yes, I saw this in AWT/Swing but there is already an implementation into a
interface.

To provide default implementations, these implementations could be in
separate classes. Such as, ComponentListenerAdapter or simply Adapter or
maybe a AdapterFactory class and use the import static keyword. What do you
think?

 

From: Greg Brown [mailto:[email protected]] 
Sent: MiƩrcoles, 21 de Abril de 2010 05:37 p.m.
To: [email protected]
Subject: Re: Constant Interface Antipattern

 

No, the Adapter classes are used to provide default implementations of
listener interfaces so a caller isn't required to implement every method.
AWT has similar adapters.

 

 

On Apr 21, 2010, at 5:32 PM, Alejandro Vilar wrote:





Hi, just an observation but there are many places where this anti-pattern
appears, for example ComponentListener.Adapter, anybody aware of that?

 

Refs:

http://en.wikipedia.org/wiki/Constant_interface

http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html

 

Cheers,

-Alejandro

 

 

 

Reply via email to