restx.endpoint.mappers.DefaultEndpointParameterMapperFactoryFactoryMachine Maven / Gradle / Ivy
package restx.endpoint.mappers;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.endpoint.mappers.DefaultEndpointParameterMapperFactory;
@Machine
public class DefaultEndpointParameterMapperFactoryFactoryMachine extends SingleNameFactoryMachine {
public static final Name NAME = Name.of(restx.endpoint.mappers.DefaultEndpointParameterMapperFactory.class, "DefaultEndpointParameterMapperFactory");
public DefaultEndpointParameterMapperFactoryFactoryMachine() {
super(0, new StdMachineEngine(NAME, 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query baseTypeAggregateEndpointParameterMapper = Factory.Query.byClass(restx.endpoint.mappers.BaseTypeAggregateEndpointParameterMapper.class).mandatory();
private final Factory.Query baseTypeEndpointParameterMapper = Factory.Query.byClass(restx.endpoint.mappers.BaseTypeEndpointParameterMapper.class).mandatory();
private final Factory.Query complexTypeEndpointParameterMapper = Factory.Query.byClass(restx.endpoint.mappers.ComplexTypeEndpointParameterMapper.class).mandatory();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
baseTypeAggregateEndpointParameterMapper,
baseTypeEndpointParameterMapper,
complexTypeEndpointParameterMapper
));
}
@Override
protected restx.endpoint.mappers.DefaultEndpointParameterMapperFactory doNewComponent(SatisfiedBOM satisfiedBOM) {
return new DefaultEndpointParameterMapperFactory(
satisfiedBOM.getOne(baseTypeAggregateEndpointParameterMapper).get().getComponent(),
satisfiedBOM.getOne(baseTypeEndpointParameterMapper).get().getComponent(),
satisfiedBOM.getOne(complexTypeEndpointParameterMapper).get().getComponent()
);
}
});
}
}