@Override protected RestxRouting doNewComponent(SatisfiedBOM satisfiedBOM) { Collection<RestxRoute> r = Lists.newArrayList(); for (RestxRouter router : satisfiedBOM.getAsComponents(routers)) { r.addAll(router.getRoutes()); } Iterables.addAll(r, satisfiedBOM.getAsComponents(routes)); return new RestxRouting( ImmutableList.copyOf(satisfiedBOM.get(filters)), ImmutableList.copyOf(satisfiedBOM.get(routeFilters)), ImmutableList.copyOf(r)); } });
public <T> Optional<NamedComponent<T>> getOne(Factory.Query<T> key) { Iterator<NamedComponent<T>> components = get(key).iterator(); if (!components.hasNext()) { return Optional.absent(); } NamedComponent<T> component = components.next(); if (components.hasNext()) { throw new IllegalStateException(String.format( "more than one component is available for %s." + " Please select which one you want with a more specific query." + " Available components are: %s", key, materials.get(key))); } return Optional.of(component); }
@Override protected RestxRouting doNewComponent(SatisfiedBOM satisfiedBOM) { Collection<RestxRoute> r = Lists.newArrayList(); for (RestxRouter router : satisfiedBOM.getAsComponents(routers)) { r.addAll(router.getRoutes()); } Iterables.addAll(r, satisfiedBOM.getAsComponents(routes)); return new RestxRouting( ImmutableList.copyOf(satisfiedBOM.get(filters)), ImmutableList.copyOf(satisfiedBOM.get(routeFilters)), ImmutableList.copyOf(r)); } });
public <T> Iterable<T> getAsComponents(Factory.Query<T> key) { return Iterables.transform(get(key), NamedComponent.<T>toComponent()); }
for (NamedComponent<ConfigSupplier> supplier : satisfiedBOM.get(configSupplierQuery)) { addAll(elements, supplier.getComponent().get().elements()); for (NamedComponent<String> s : satisfiedBOM.get(stringsQuery)) { Optional<ConfigElement> element = config.getElement(s.getName().getName()); if (element.isPresent() && element.get().getValue().equals(s.getComponent())) {