EventBus icon indicating copy to clipboard operation
EventBus copied to clipboard

Make EventBus(EventBusBuilder) constructor public.

Open trashkalmar opened this issue 9 years ago • 5 comments

There are scenarios when it is better to use EventBus as base class. In this case it is impossible to construct custom class which is configured by EventBusBuilder builder. This PR makes the EventBus(EventBusBuilder) constructor public to support latter case.

trashkalmar avatar Mar 22 '16 21:03 trashkalmar

But this will break the build pattern, if so, user can just new EventBus instance directly, which will make EventBusBuilder.build method less important.

IMO, If there are many choices, there's no choices. What do you say?

zxw1962 avatar Apr 14 '16 02:04 zxw1962

Why? User can continue to use pattern and create EventBus instance with builder. However, at this time I'm unable to use EventBus as base class and create descendants configured with the builder.

trashkalmar avatar Apr 14 '16 08:04 trashkalmar

What's the use case for subclassing EventBus? I would instead argue for making the class final and explicitly disallow subclassing.

william-ferguson-au avatar May 12 '16 11:05 william-ferguson-au

Use case is very simple. I'd like to perform some action while registering event handler, i.e. override register/unregister methods in EventBus. Also I'd like to customize EventBus`s behavior with Builder (disable event inheritance in my case). However, at this time I have to create wrapper and pass register/unregister/post/postSticky calls to wrapped EventBus instance configured with Builder.

trashkalmar avatar May 21 '16 14:05 trashkalmar

@greenrobot so, what do you think?

trashkalmar avatar Feb 06 '17 08:02 trashkalmar