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 Object
implements com.github.philippheuer.events4j.api.service.IServiceMediator
The ServiceMediator
The ServiceMediator provides access to 3rd party services for your custom events
-
Constructor Summary
ConstructorsConstructorDescriptionServiceMediator(com.github.philippheuer.events4j.api.IEventManager eventManager) The Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddService(@NonNull String serviceName, @NonNull Object serviceInstance) Add a service to the ServiceMediator.com.github.philippheuer.events4j.api.IEventManagerHolds a reference of the EventManager<T> @NonNull TgetService(@NonNull Class<T> serviceClass, @NonNull String serviceName) Gets a service from the ServiceMediator
-
Constructor Details
-
ServiceMediator
public ServiceMediator(com.github.philippheuer.events4j.api.IEventManager eventManager) The Constructor.- Parameters:
eventManager- The EventManager
-
-
Method Details
-
addService
Add a service to the ServiceMediator.- Specified by:
addServicein interfacecom.github.philippheuer.events4j.api.service.IServiceMediator- Parameters:
serviceName- The ServiceNameserviceInstance- The ServiceInstance
-
getService
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
-