IMHO code into a interface should not be implemented in any case, but I understand your point of view, thanks for the quick response J.
Regards, Alejandro From: Greg Brown [mailto:[email protected]] Sent: MiƩrcoles, 21 de Abril de 2010 06:19 p.m. To: [email protected] Subject: Re: Constant Interface Antipattern Technically, there's not much difference between ComponentListenerAdapter and ComponentListener.Adapter. We chose to go with the latter because it more strongly associates the adapter class with the interface definition and reduces the number of source files to navigate. On Apr 21, 2010, at 5:53 PM, Alejandro Vilar wrote: 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
