restx.entity.EntityRequestBodyReaderRegistryFactoryMachine Maven / Gradle / Ivy
package restx.entity;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.entity.EntityRequestBodyReaderRegistry;
@Machine
public class EntityRequestBodyReaderRegistryFactoryMachine extends SingleNameFactoryMachine {
public static final Name NAME = Name.of(restx.entity.EntityRequestBodyReaderRegistry.class, "EntityRequestBodyReaderRegistry");
public EntityRequestBodyReaderRegistryFactoryMachine() {
super(0, new StdMachineEngine(NAME, 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query entityDefaultContentTypeProviders = Factory.Query.byClass(restx.entity.EntityDefaultContentTypeProvider.class).optional();
private final Factory.Query entityRequestBodyReaderFactories = Factory.Query.byClass(restx.entity.EntityRequestBodyReaderFactory.class).optional();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
entityDefaultContentTypeProviders,
entityRequestBodyReaderFactories
));
}
@Override
protected restx.entity.EntityRequestBodyReaderRegistry doNewComponent(SatisfiedBOM satisfiedBOM) {
return new EntityRequestBodyReaderRegistry(
satisfiedBOM.getAsComponents(entityDefaultContentTypeProviders),
satisfiedBOM.getAsComponents(entityRequestBodyReaderFactories)
);
}
});
}
}