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
    void addService​(java.lang.String serviceName, java.lang.Object serviceInstance)
    Add a service to the ServiceMediator.
    com.github.philippheuer.events4j.api.IEventManager getEventManager()
    Holds a reference of the EventManager
    <T> T getService​(java.lang.Class<T> serviceClass, java.lang.String serviceName)
    Gets a service from the ServiceMediator

    Methods 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:
      addService in interface com.github.philippheuer.events4j.api.service.IServiceMediator
      Parameters:
      serviceName - The ServiceName
      serviceInstance - The ServiceInstance
    • getService

      public <T> T getService​(java.lang.Class<T> serviceClass, java.lang.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