org.apache.tapestry5.ioc

## 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 Guice.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> ServiceBindingOptions` | `bind(Class<T> implementationClass)` Defines a service in terms of an implementation class, without a service interface.
    `<T> ServiceBindingOptions` | `bind(Class<T> serviceInterface, Class<? extends T> serviceImplementation)` Binds the service interface to a service implementation class.
    `<T> ServiceBindingOptions` | `bind(Class<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> ServiceBindingOptions bind(Class<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> ServiceBindingOptions bind(Class<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> ServiceBindingOptions bind(Class<T> serviceInterface,
                                         Class<? 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

5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.