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

restx.entity.EntityResponseWriterRegistryFactoryMachine Maven / Gradle / Ivy

There is a newer version: 1.2.0-rc2
Show newest version
package restx.entity;

import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.entity.EntityResponseWriterRegistry;

@Machine
public class EntityResponseWriterRegistryFactoryMachine extends SingleNameFactoryMachine {
    public static final Name NAME = Name.of(restx.entity.EntityResponseWriterRegistry.class, "EntityResponseWriterRegistry");

    public EntityResponseWriterRegistryFactoryMachine() {
        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 entityResponseWriterFactories = Factory.Query.byClass(restx.entity.EntityResponseWriterFactory.class).optional();

            @Override
            public BillOfMaterials getBillOfMaterial() {
                return new BillOfMaterials(ImmutableSet.>of(
entityDefaultContentTypeProviders,
entityResponseWriterFactories
                ));
            }

            @Override
            protected restx.entity.EntityResponseWriterRegistry doNewComponent(SatisfiedBOM satisfiedBOM) {
                return new EntityResponseWriterRegistry(
satisfiedBOM.getAsComponents(entityDefaultContentTypeProviders),
satisfiedBOM.getAsComponents(entityResponseWriterFactories)
                );
            }
        });
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy