All Downloads are FREE. Search and download functionalities are using the official Maven repository.

samplest.hello.primitive.PrimitiveResourceFactoryMachine Maven / Gradle / Ivy

There is a newer version: 1.2.0-rc2
Show newest version
package samplest.hello.primitive;

import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import samplest.hello.primitive.PrimitiveResource;

@Machine
public class PrimitiveResourceFactoryMachine extends SingleNameFactoryMachine {
    public static final Name NAME = Name.of(samplest.hello.primitive.PrimitiveResource.class, "PrimitiveResource");

    public PrimitiveResourceFactoryMachine() {
        super(0, new StdMachineEngine(NAME, 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query anInt = Factory.Query.byName(Name.of(java.lang.Integer.class, "int")).mandatory();
private final Factory.Query anIntWhen = Factory.Query.byName(Name.of(java.lang.Integer.class, "intWhen")).mandatory();
private final Factory.Query anIntAlternativeWhen = Factory.Query.byName(Name.of(java.lang.Integer.class, "intAlternativeWhen")).mandatory();

            @Override
            public BillOfMaterials getBillOfMaterial() {
                return new BillOfMaterials(ImmutableSet.>of(
anInt,
anIntWhen,
anIntAlternativeWhen
                ));
            }

            @Override
            protected samplest.hello.primitive.PrimitiveResource doNewComponent(SatisfiedBOM satisfiedBOM) {
                return new PrimitiveResource(
satisfiedBOM.getOne(anInt).get().getComponent(),
satisfiedBOM.getOne(anIntWhen).get().getComponent(),
satisfiedBOM.getOne(anIntAlternativeWhen).get().getComponent()
                );
            }
        });
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy