camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: Extends & Implements
Date Fri, 17 Aug 2007 10:17:10 GMT
On 8/17/07, mat wang <> wrote:
> The following is just what I thought, no offense.

None taken :)

> "extends" = "is a " relationship between subclass and superclass
>    a digital clock is a clock (DigitalClock extends)
> "implements" = "has a"
>    a digital clock has an alarm function (DigitalClock implements Alarm)
> In Camel, something made me feel uncomfortable. Such as:
> public abstract  class DefaultComponent<E extends Exchange> extends
> ServiceSupport implements Component<E>
> Is DefaultComponent supposed to be a Component and has ServiceSupport
> function (start, stop)?

Yes. In Java you cannot have multiple inheritence; so in this case we
are inheriting the base start/stop lifecycle code from ServiceSupport,
but really a DefaultComponent is-a Component. (It just so happens it
also "is a" Service)

Currently its optional whether a Component implementation "is-a"
Service (just like lifecycle APIs/ annotations are optional in Spring
and EJB3); I guess we could make that mandatory.


View raw message