Class SimpleServiceProvider

  • All Implemented Interfaces:
    Services, ServicesProvider

    public class SimpleServiceProvider
    extends java.lang.Object
    implements Services, ServicesProvider
    A simple implementation of Services and ServicesProvider that returns services from the map supplied during construction.
    • Constructor Detail

      • SimpleServiceProvider

        public SimpleServiceProvider​(java.util.Map<java.lang.Class<? extends AppService>,​java.lang.Object> services)
        Parameters:
        services - Map of service types to service instances
    • Method Detail

      • hasService

        public boolean hasService​(java.lang.Class<? extends AppService> type)
        Specified by:
        hasService in interface Services
        Parameters:
        type - service type
        Returns:
        true if the service type is available
      • getService

        public <T extends AppService> T getService​(java.lang.Class<T> type)
        Description copied from interface: Services
        Returns the service of the given type if available
        Specified by:
        getService in interface Services
        Type Parameters:
        T - service tye
        Parameters:
        type - type class
        Returns:
        service