restx.specs.RestxSpecRepositoryFactoryMachine Maven / Gradle / Ivy
package restx.specs;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.specs.RestxSpecRepository;
@Machine
public class RestxSpecRepositoryFactoryMachine extends SingleNameFactoryMachine {
public static final Name NAME = Name.of(restx.specs.RestxSpecRepository.class, "RestxSpecRepository");
public RestxSpecRepositoryFactoryMachine() {
super(0, new StdMachineEngine(NAME, 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query specLoader = Factory.Query.byClass(restx.specs.RestxSpecLoader.class).mandatory();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
specLoader
));
}
@Override
protected restx.specs.RestxSpecRepository doNewComponent(SatisfiedBOM satisfiedBOM) {
return new RestxSpecRepository(
satisfiedBOM.getOne(specLoader).get().getComponent()
);
}
});
}
}