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