Class ForwardingServiceRegistry

    • Constructor Detail

      • ForwardingServiceRegistry

        public ForwardingServiceRegistry()
    • Method Detail

      • add

        public <S extends Service> void add​(Class<S> type,
                                            S service)
        Description copied from interface: ServiceRegistry
        Add a service
        Specified by:
        add in interface ServiceRegistry
        Type Parameters:
        S - the service type to add
        Parameters:
        type - the service type to add
        service - the service implementation
        See Also:
        Service
      • contains

        public <S extends Service> boolean contains​(Class<S> type)
        Description copied from interface: ServiceRegistry
        Check if a service is registered
        Specified by:
        contains in interface ServiceRegistry
        Type Parameters:
        S - the service type
        Parameters:
        type - the service type
        Returns:
        true if a service is registered, otherwise false
      • get

        public <S extends Service> S get​(Class<S> type)
        Description copied from interface: ServiceRegistry
        Retrieve a service implementation
        Specified by:
        get in interface ServiceRegistry
        Type Parameters:
        S - the service type
        Parameters:
        type - the service type
        Returns:
        the service implementation, or null if none is registered
      • getRequired

        public <S extends Service> S getRequired​(Class<S> type)
        Description copied from interface: ServiceRegistry
        Retrieve a required service implementation. Throws an exception if the service is not available
        Specified by:
        getRequired in interface ServiceRegistry
        Type Parameters:
        S - the service type
        Parameters:
        type - the service type
        Returns:
        the service implementation
      • addIfAbsent

        public <S extends Service> S addIfAbsent​(Class<S> type,
                                                 S service)
        Description copied from interface: ServiceRegistry
        Add a service if no implementation of the given service is registered with the registry yet. Returns null if the given service was added. Otherwise, the previous service implementation is returned.
        Specified by:
        addIfAbsent in interface ServiceRegistry
        Type Parameters:
        S - the service type to add
        Parameters:
        type - the service type to add
        service - the service implementation
        Returns:
        null if no service implementation was previously associated with the given service. Otherwise, the previous service implementation is returned.