restx.specs.SpecModuleFactoryMachine Maven / Gradle / Ivy
package restx.specs;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.specs.SpecModule;
@Machine
public class SpecModuleFactoryMachine extends DefaultFactoryMachine {
private static final SpecModule module = new SpecModule();
public SpecModuleFactoryMachine() {
super(0, new MachineEngine[] {
new StdMachineEngine(Name.of(restx.config.ConfigSupplier.class, "specConfigSupplier"), 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query configLoader = Factory.Query.byClass(restx.config.ConfigLoader.class).mandatory();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
configLoader
));
}
@Override
public restx.config.ConfigSupplier doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.specConfigSupplier(
satisfiedBOM.getOne(configLoader).get().getComponent()
);
}
},
});
}
}