This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • StrategyBuilder Service

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed Related Articles

Wiki Markup
{scrollbar}

Strategy Pattern

...

The StrategyBuilder Service provides a convenient way to create an implementation of the Strategy design pattern.

Div
stylefloat:right
titleRelated Articles
classaui-label
Content by Label
showLabelsfalse
showSpacefalse
titleRelated Articles
cqllabel = "service-builders" and space = currentSpace()

Another of the Gang Of Four patterns, the strategy pattern as implemented in Tapestry IoC is a kind of late binding.

...

The StrategyBuilder service (API) creates a service implementation around a strategy registry.

Code Block
java
java

public interface StrategyBuilder
{
    <S> S build(StrategyRegistry<S> registry);
}

...

You convert the configuration into a StrategyRegistry, and use that to build the final service:

Code Block
java
java
   public static MyStrategyService build(Map<Class, MyStrategyService> configuration,
    @InjectService("StrategyBuilder")
    StrategyBuilder builder)
  {
     StategyRegistry<MyStrategyService> registry = StrategyRegistry.newInstance(MyStrategyService.class, configuration);
  
     return builder.build(registry);
  }

Wiki Markup
{scrollbar}