Class ServiceMediator
java.lang.Object
com.github.philippheuer.events4j.core.services.ServiceMediator
- All Implemented Interfaces:
com.github.philippheuer.events4j.api.service.IServiceMediator
public final class ServiceMediator
extends java.lang.Object
implements com.github.philippheuer.events4j.api.service.IServiceMediator
The ServiceMediator
The ServiceMediator provides access to 3rd party services for your custom events
- Since:
- 1.0
-
Constructor Summary
Constructors Constructor Description ServiceMediator(com.github.philippheuer.events4j.api.IEventManager eventManager)The Constructor. -
Method Summary
Modifier and Type Method Description voidaddService(java.lang.String serviceName, java.lang.Object serviceInstance)Add a service to the ServiceMediator.com.github.philippheuer.events4j.api.IEventManagergetEventManager()Holds a reference of the EventManager<T> TgetService(java.lang.Class<T> serviceClass, java.lang.String serviceName)Gets a service from the ServiceMediatorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ServiceMediator
public ServiceMediator(com.github.philippheuer.events4j.api.IEventManager eventManager)The Constructor.- Parameters:
eventManager- The EventManager
-
-
Method Details
-
addService
public void addService(java.lang.String serviceName, java.lang.Object serviceInstance)Add a service to the ServiceMediator.- Specified by:
addServicein interfacecom.github.philippheuer.events4j.api.service.IServiceMediator- Parameters:
serviceName- The ServiceNameserviceInstance- The ServiceInstance
-
getService
public <T> T getService(java.lang.Class<T> serviceClass, java.lang.String serviceName)Gets a service from the ServiceMediator- Specified by:
getServicein interfacecom.github.philippheuer.events4j.api.service.IServiceMediator- Type Parameters:
T- The type of the Service- Parameters:
serviceClass- The ServiceClass you expectserviceName- The ServiceName- Returns:
- The ServiceInstance
-
getEventManager
public com.github.philippheuer.events4j.api.IEventManager getEventManager()Holds a reference of the EventManager
-