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