All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
samplest.hello.primitive.PrimitiveModuleFactoryMachine Maven / Gradle / Ivy
package samplest.hello.primitive;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import samplest.hello.primitive.PrimitiveModule;
@Machine
public class PrimitiveModuleFactoryMachine extends DefaultFactoryMachine {
private static final PrimitiveModule module = new PrimitiveModule();
public PrimitiveModuleFactoryMachine() {
super(0, new MachineEngine[] {
new StdMachineEngine(Name.of(java.lang.Integer.class, "int"), 0, BoundlessComponentBox.FACTORY) {
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
));
}
@Override
public java.lang.Integer doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.integer(
);
}
},
new StdMachineEngine(Name.of(java.lang.Integer.class, "intAlternativeWhen"), 0, BoundlessComponentBox.FACTORY) {
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
));
}
@Override
public java.lang.Integer doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.integerAlternativeWhen(
);
}
},
new StdMachineEngine(
Name.of(FactoryMachine.class, "integerWhenintWhenConditional"), 0, BoundlessComponentBox.FACTORY) {
private Factory.Query query = Factory.Query.byName(Name.of(String.class, "restx.mode")).optional();
@Override
protected FactoryMachine doNewComponent(SatisfiedBOM satisfiedBOM) {
if (satisfiedBOM.getOne(query).isPresent()
&& satisfiedBOM.getOne(query).get().getComponent().equals("test")) {
return new SingleNameFactoryMachine(0,
new StdMachineEngine(
Name.of(java.lang.Integer.class, "intWhen"),
0, BoundlessComponentBox.FACTORY) {
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
));
}
@Override
protected java.lang.Integer doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.integerWhen(
);
}
});
} else {
return NoopFactoryMachine.INSTANCE;
}
}
@Override
public BillOfMaterials getBillOfMaterial() {
return BillOfMaterials.of(query);
}
},
new StdMachineEngine(
Name.of(FactoryMachine.class, "integerWhenDevintWhenConditional"), 0, BoundlessComponentBox.FACTORY) {
private Factory.Query query = Factory.Query.byName(Name.of(String.class, "restx.mode")).optional();
@Override
protected FactoryMachine doNewComponent(SatisfiedBOM satisfiedBOM) {
if (satisfiedBOM.getOne(query).isPresent()
&& satisfiedBOM.getOne(query).get().getComponent().equals("dev")) {
return new SingleNameFactoryMachine(0,
new StdMachineEngine(
Name.of(java.lang.Integer.class, "intWhen"),
0, BoundlessComponentBox.FACTORY) {
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
));
}
@Override
protected java.lang.Integer doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.integerWhenDev(
);
}
});
} else {
return NoopFactoryMachine.INSTANCE;
}
}
@Override
public BillOfMaterials getBillOfMaterial() {
return BillOfMaterials.of(query);
}
},
new StdMachineEngine(
Name.of(FactoryMachine.class, "integerAlternativeWhenAltintAlternativeWhenAlternative"), 0, BoundlessComponentBox.FACTORY) {
private Factory.Query query = Factory.Query.byName(Name.of(String.class, "restx.mode")).optional();
@Override
protected FactoryMachine doNewComponent(SatisfiedBOM satisfiedBOM) {
if (satisfiedBOM.getOne(query).isPresent()
&& satisfiedBOM.getOne(query).get().getComponent().equals("test")) {
return new SingleNameFactoryMachine(-1000,
new StdMachineEngine(
Name.of(java.lang.Integer.class, "intAlternativeWhen"),
-1000, BoundlessComponentBox.FACTORY) {
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
));
}
@Override
protected java.lang.Integer doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.integerAlternativeWhenAlt(
);
}
});
} else {
return NoopFactoryMachine.INSTANCE;
}
}
@Override
public BillOfMaterials getBillOfMaterial() {
return BillOfMaterials.of(query);
}
},
});
}
}