restx.jongo.JongoModuleFactoryMachine Maven / Gradle / Ivy
The newest version!
package restx.jongo;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.jongo.JongoModule;
@Machine
public class JongoModuleFactoryMachine extends DefaultFactoryMachine {
private static final JongoModule module = new JongoModule();
public JongoModuleFactoryMachine() {
super(0, new MachineEngine[] {
new StdMachineEngine(Name.of(org.jongo.Mapper.class, "Mapper"), 0, BoundlessComponentBox.FACTORY) {
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
));
}
@Override
public org.jongo.Mapper doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.mapper(
);
}
},
new StdMachineEngine(Name.of(org.jongo.Jongo.class, "Jongo"), 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query dbName = Factory.Query.byName(Name.of(java.lang.String.class, "mongo.db")).mandatory();
private final Factory.Query mongoClient = Factory.Query.byName(Name.of(com.mongodb.MongoClient.class, "mongoClient")).mandatory();
private final Factory.Query mapper = Factory.Query.byName(Name.of(org.jongo.Mapper.class, "Mapper")).mandatory();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
dbName,
mongoClient,
mapper
));
}
@Override
public org.jongo.Jongo doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.jongo(
satisfiedBOM.getOne(dbName).get().getComponent(),
satisfiedBOM.getOne(mongoClient).get().getComponent(),
satisfiedBOM.getOne(mapper).get().getComponent()
);
}
},
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy