Interface ServiceBinder

  • All Known Implementing Classes:
    ServiceBinderImpl

    public interface ServiceBinder
    Allows a module to bind service interfaces to service implementation classes in support of autobuilding services. A ServiceBinder is passed to to a method with the following signature: public static void bind(ServiceBinder binder). This is an adaptation of ideas from .
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> ServiceBindingOptions <T> implementationClass)
      Defines a service in terms of an implementation class, without a service interface.
      <T> ServiceBindingOptions <T> serviceInterface, <? extends T> serviceImplementation)
      Binds the service interface to a service implementation class.
      <T> ServiceBindingOptions <T> serviceInterface, ServiceBuilder<T> builder)
      Alternative implementation that supports a callback to build the service, rather than instantiating a particular class.
    • Method Detail

      • bind

        <T> <T> implementationClass)
        Defines a service in terms of an implementation class, without a service interface. In this case, the service will not be proxiable (proxying requires a service interface) and ServiceDef.getServiceInterface() will return the implementation class. In this situation, the service will not be proxied; it will be instantiated fully on first reference (ignoring its scope, if any) and will not be decorated.
        Type Parameters:
        T -
        Parameters:
        implementationClass - class to instantiate as the service
        Returns:
        binding options, used to specify additional details about the service
      • bind

        <T> <T> serviceInterface,
                                       ServiceBuilder<T> builder)
        Alternative implementation that supports a callback to build the service, rather than instantiating a particular class.
        Parameters:
        serviceInterface - interface implemented by the service
        builder - constructs the core service implementation
        Returns:
        binding options, used to specify additional details about the service
      • bind

        <T> <T> serviceInterface,
                                       <? extends T> serviceImplementation)
        Binds the service interface to a service implementation class. The default service name is the unqualified name of the service interface. The default service scope is "singleton", unless the service implementation class includes the Scope annotation.
        Type Parameters:
        T -
        Parameters:
        serviceInterface - service interface (used when locating services, and when building proxies)
        serviceImplementation - implementation class that implements the service interface
        Returns:
        binding options, used to specify additional details about the service