samplest.hello.FactoryInjectionResourceFactoryMachine Maven / Gradle / Ivy
package samplest.hello;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import samplest.hello.FactoryInjectionResource;
@Machine
public class FactoryInjectionResourceFactoryMachine extends SingleNameFactoryMachine {
public static final Name NAME = Name.of(samplest.hello.FactoryInjectionResource.class, "FactoryInjectionResource");
public FactoryInjectionResourceFactoryMachine() {
super(0, new StdMachineEngine(NAME, 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query testSetInjection = Factory.Query.byClass(samplest.hello.TestSetInjection.class).optional();
private final Factory.Query testSetAbstract = Factory.Query.byClass(samplest.hello.TestSetAbstract.class).optional();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
testSetInjection,
testSetAbstract
));
}
@Override
protected samplest.hello.FactoryInjectionResource doNewComponent(SatisfiedBOM satisfiedBOM) {
return new FactoryInjectionResource(
com.google.common.collect.Sets.newLinkedHashSet(satisfiedBOM.getAsComponents(testSetInjection)),
com.google.common.collect.Sets.newLinkedHashSet(satisfiedBOM.getAsComponents(testSetAbstract))
);
}
});
}
}