Buss is now to be accessed from some static method or field.master
parent
fbd1ac78fa
commit
ab75bb018f
@ -1,16 +0,0 @@ |
||||
package mightypork.utils.eventbus; |
||||
|
||||
|
||||
/** |
||||
* Access to an {@link EventBus} instance |
||||
* |
||||
* @author Ondřej Hruška (MightyPork) |
||||
*/ |
||||
public interface BusAccess { |
||||
|
||||
/** |
||||
* @return event bus |
||||
*/ |
||||
EventBus getEventBus(); |
||||
|
||||
} |
@ -1,60 +0,0 @@ |
||||
package mightypork.utils.eventbus.clients; |
||||
|
||||
|
||||
import mightypork.utils.annotations.Stub; |
||||
import mightypork.utils.eventbus.BusAccess; |
||||
import mightypork.utils.interfaces.Destroyable; |
||||
|
||||
|
||||
/** |
||||
* Bus node that should be directly attached to the bus. |
||||
* |
||||
* @author Ondřej Hruška (MightyPork) |
||||
*/ |
||||
public abstract class RootBusNode extends BusNode implements Destroyable { |
||||
|
||||
/** |
||||
* Create with a bus access. |
||||
* |
||||
* @param busAccess access to bus |
||||
*/ |
||||
public RootBusNode(BusAccess busAccess) { |
||||
super(busAccess); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Create without a bus access. It should be assigned later. |
||||
*/ |
||||
public RootBusNode() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void onBusReady() |
||||
{ |
||||
getEventBus().subscribe(this); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final void destroy() |
||||
{ |
||||
deinit(); |
||||
|
||||
if (getEventBus() != null) { |
||||
getEventBus().unsubscribe(this); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Deinitialize the node (subsystem)<br> |
||||
* (called during destruction) |
||||
*/ |
||||
@Stub |
||||
protected void deinit() |
||||
{ |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue