You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
962 B
60 lines
962 B
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()
|
|
{
|
|
}
|
|
|
|
}
|
|
|