public Factory build() {
Factory factory = new Factory(
usedServiceLoader, machines, ImmutableList.<ComponentCustomizerEngine>of(),
new StdWarehouse(ImmutableList.copyOf(providers)));
Map<Name<FactoryMachine>, MachineEngine<FactoryMachine>> toBuild = new LinkedHashMap<>();
ImmutableList<FactoryMachine> factoryMachines = buildFactoryMachines(factory, factory.machines, toBuild);
while (!factoryMachines.isEmpty()) {
machines.putAll("FactoryMachines", factoryMachines);
factory = new Factory(usedServiceLoader, machines,
ImmutableList.<ComponentCustomizerEngine>of(), new StdWarehouse());
factoryMachines = buildFactoryMachines(factory, factoryMachines, toBuild);
}
factory = new Factory(usedServiceLoader, machines,
buildCustomizerEngines(factory), new StdWarehouse(ImmutableList.copyOf(providers)));
return factory;
}