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

    Modifier and Type
    Method
    Description
    <S> S
    build(Class<S> adapterType, Map<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 Details

    • 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(Class<S> adapterType, Map<Class,S> registrations)
      Type Parameters:
      S -
      Parameters:
      registrations - map frm class to the adapter type
      Returns:
      the dispatcher
      Since:
      5.1.0.0