Package com.jme3.network.service
Class AbstractService<S extends ServiceManager>
java.lang.Object
com.jme3.network.service.AbstractService<S>
- All Implemented Interfaces:
Service<S>
- Direct Known Subclasses:
AbstractClientService
,AbstractHostedService
public abstract class AbstractService<S extends ServiceManager>
extends Object
implements Service<S>
Base class providing some default Service interface implementations
as well as a few convenience methods such as getServiceManager()
and getService(type). Subclasses must at least override the
onInitialize() method to handle service initialization.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetService
(Class<T> type) Retrieves the first sibling service of the specified type.protected S
Returns the ServiceManager that was passed to initialize() during service initialization.final void
initialize
(S serviceManager) Initializes this service by keeping a reference to the service manager and calling onInitialize().protected abstract void
onInitialize
(S serviceManager) Called during initialize() for the subclass to perform implementation specific initialization.void
start()
Default implementation does nothing.void
stop()
Default implementation does nothing.void
Default implementation does nothing.toString()
-
Constructor Details
-
AbstractService
protected AbstractService()
-
-
Method Details
-
getServiceManager
Returns the ServiceManager that was passed to initialize() during service initialization. -
getService
Retrieves the first sibling service of the specified type. -
initialize
Initializes this service by keeping a reference to the service manager and calling onInitialize().- Specified by:
initialize
in interfaceService<S extends ServiceManager>
-
onInitialize
Called during initialize() for the subclass to perform implementation specific initialization. -
start
public void start()Default implementation does nothing. Implementations can override this to perform custom startup behavior.- Specified by:
start
in interfaceService<S extends ServiceManager>
-
stop
public void stop()Default implementation does nothing. Implementations can override this to perform custom stop behavior.- Specified by:
stop
in interfaceService<S extends ServiceManager>
-
terminate
Default implementation does nothing. Implementations can override this to perform custom termination behavior.- Specified by:
terminate
in interfaceService<S extends ServiceManager>
-
toString
-