public ChainSpecification addComponents(Collection<ComponentSpecification> componentSpecifications) { Set<ComponentSpecification> newComponentReferences = new LinkedHashSet<>(componentReferences); newComponentReferences.addAll(componentSpecifications); return new ChainSpecification(componentId, inheritance, phases(), newComponentReferences); }
public ChainSpecification setComponentId(ComponentId newComponentId) { return new ChainSpecification(newComponentId, inheritance, phases(), componentReferences); }
public ChainSpecification addInherits(Collection<ComponentSpecification> inheritedChains) { return new ChainSpecification(componentId, inheritance.addInherits(inheritedChains), phases(), componentReferences); }
@Override public ChainSpecification getChainSpecification() { ChainSpecification spec = super.getChainSpecification(); return new ChainSpecification(spec.componentId, spec.inheritance, spec.phases(), disableStemmingIfStreaming(spec.componentReferences)); }
private static <COMPONENT extends ChainedComponent> void instantiateChains( ComponentRegistry<Chain<COMPONENT>> chainRegistry, ChainsModel model, ComponentRegistry<COMPONENT> allComponents) { for (ChainSpecification chain : model.allChainsFlattened()) { try { Chain<COMPONENT> componentChain = new Chain<>(chain.componentId, resolveComponents(chain.componentReferences, allComponents), chain.phases()); chainRegistry.register(chain.componentId, componentChain); } catch (Exception e) { throw new ConfigurationRuntimeException("Invalid chain '" + chain.componentId + "'", e); } } }
private static <T extends Chain> ChainsConfig.Chains.Builder getChain(T chain) { ChainSpecification specification = chain.getChainSpecification(); return new ChainsConfig.Chains.Builder() .type(chain.getType()) .id(specification.componentId.stringValue()) .components(getComponents(specification.componentReferences)) .inherits(getComponents(specification.inheritance.chainSpecifications)) .excludes(getComponents(specification.inheritance.excludedComponents)) .phases(getPhases(specification.phases())); }