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

Since:
1.0
  • Constructor Details

    • ServiceMediator

      public ServiceMediator(com.github.philippheuer.events4j.api.IEventManager eventManager)
      The Constructor.
      Parameters:
      eventManager - The EventManager
  • Method Details

    • addService

      public void addService(String serviceName, Object serviceInstance)
      Add a service to the ServiceMediator.
      Specified by:
      addService in interface com.github.philippheuer.events4j.api.service.IServiceMediator
      Parameters:
      serviceName - The ServiceName
      serviceInstance - The ServiceInstance
    • getService

      public <T> T getService(Class<T> serviceClass, String serviceName)
      Gets a service from the ServiceMediator
      Specified by:
      getService in interface com.github.philippheuer.events4j.api.service.IServiceMediator
      Type Parameters:
      T - The type of the Service
      Parameters:
      serviceClass - The ServiceClass you expect
      serviceName - The ServiceName
      Returns:
      The ServiceInstance
    • getEventManager

      public com.github.philippheuer.events4j.api.IEventManager getEventManager()
      Holds a reference of the EventManager