Ejemplo n.º 1
0
  public AssetSourceImpl(
      ThreadLocale threadLocale,
      Map<String, AssetFactory> configuration,
      SymbolSource symbolSource,
      Logger logger,
      OperationTracker tracker,
      Request request) {
    this.configuration = configuration;
    this.threadLocale = threadLocale;
    this.symbolSource = symbolSource;
    this.logger = logger;
    this.tracker = tracker;
    this.request = request;

    Map<Class, AssetFactory> byResourceClass = CollectionFactory.newMap();

    for (Map.Entry<String, AssetFactory> e : configuration.entrySet()) {
      String prefix = e.getKey();
      AssetFactory factory = e.getValue();

      Resource rootResource = factory.getRootResource();

      byResourceClass.put(rootResource.getClass(), factory);

      prefixToRootResource.put(prefix, rootResource);
    }

    registry = StrategyRegistry.newInstance(AssetFactory.class, byResourceClass);
  }
Ejemplo n.º 2
0
 public CacheProcessorSourceImpl(
     Map<Class, CacheProcessor> configuration,
     PropertyAccess propertyAccess,
     TypeCoercer coercer,
     EntityService entityService) {
   registry = StrategyRegistry.newInstance(CacheProcessor.class, configuration, true);
   this.propertyAccess = propertyAccess;
   this.coercer = coercer;
   this.entityService = entityService;
 }
 public MonitorNameGeneratorImpl(
     Map<Class, MonitorNameGenerator> source,
     @Autobuild DefaultMonitorNameGenerator defaultMonitorNameGenerator) {
   this.defaultMonitorNameGenerator = defaultMonitorNameGenerator;
   strategyRegistry = StrategyRegistry.newInstance(MonitorNameGenerator.class, source, true);
 }
  @Override
  public <S> S build(Class<S> adapterType, Map<Class, S> registrations) {
    StrategyRegistry<S> registry = StrategyRegistry.newInstance(adapterType, registrations);

    return build(registry);
  }