Hi Neil,

Thx for the clarification and explanation. You are right, without an
interface, that means that we couple the producer and the consumer. Stupid
thing indeed.

Regards,

On Fri, Oct 24, 2014 at 7:09 PM, Neil Bartlett <[email protected]> wrote:

> It depends what you mean by “expose”.
>
> You can register an object as a service, yes, but if it’s not implementing
> an interface, what kind of service will it be? You can only register it as
> its own type or as java.lang.Object. This is not very useful except in rare
> edge-cases.
>
> If you publish it as its own type and clients look it up by that type,
> then the clients are not decoupled from the implementation and you defeat
> the whole purpose of using a service. If you publish as java.lang.Object
> then how to clients know what methods they can call? They would have to use
> reflection; the Gogo shell works like this but it’s very unusual.
>
> Neil
>
>
> From: Charles Moulliard <[email protected]> <[email protected]>
> Reply: [email protected] <[email protected]>>
> <[email protected]>
> Date: 24 October 2014 at 18:01:24
> To: [email protected] <[email protected]>>
> <[email protected]>
> Subject:  SCR : Serve a Bean without interface
>
> Hi,
>
> Would it be possible using Apache Felix SCR to expose a bean / class as a
> OSGI service ? REMARK : This class does not implement at all an interface.
>
> Regards,
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
>
>


-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Reply via email to