Package org.apache.tapestry5.ioc.services

## Interface StrategyBuilder

- All Known Implementing Classes:
    `StrategyBuilderImpl`

      public interface StrategyBuilder

  A service implementation builder that operates around a `StrategyRegistry`, implementing a version of the Gang of Four Strategy pattern. The constructed service is configured with a number of adapters (that implement the same service interface). Method invocations on the service are routed to one of the adapters. The first parameter of each method is used to select the appropriate adapter. The ideal interface for use with this builder has only one method.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<S> S` | `build​(java.lang.Class<S> adapterType, java.util.Map<java.lang.Class,​S> registrations)` |
    `<S> S` | `build​(StrategyRegistry<S> registry)` | Given a number of adapters implementing the service interface, builds a "dispatcher" implementations that delegates to the one of the adapters.

- - ### Method Detail

    - #### build

          <S> S build​(StrategyRegistry<S> registry)

      Given a number of adapters implementing the service interface, builds a "dispatcher" implementations that delegates to the one of the adapters. It is an error if any of the methods takes no parameters.
      Type Parameters:
        `S` - the service interface type
      Parameters:
        `registry` - defines the adapters based on parameter type (of the first parameter)
      Returns:
        a service implementation

    - #### build

          <S> S build​(java.lang.Class<S> adapterType,
                      java.util.Map<java.lang.Class,​S> registrations)

      Type Parameters:
        `S` -
      Parameters:
        `registrations` - map frm class to the adapter type
      Returns:
        the dispatcher
      Since:
        5.1.0.0