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

moxproxy.builders.MoxProxyHeadersCollectionBuilder Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
package moxproxy.builders;

import moxproxy.exceptions.BuilderValidationException;
import moxproxy.model.MoxProxyHeader;

import java.util.ArrayList;
import java.util.List;

class MoxProxyHeadersCollectionBuilder extends CollectionBuilder, MoxProxyHeadersCollectionBuilderValidator> {

    private MoxProxyHttpRuleDefinitionBuilder moxProxyHttpRuleDefinitionBuilder;

    MoxProxyHeadersCollectionBuilder(MoxProxyHttpRuleDefinitionBuilder moxProxyHttpRuleDefinitionBuilder) {
        super(moxProxyHttpRuleDefinitionBuilder, new MoxProxyHeadersCollectionBuilderValidator());
        this.moxProxyHttpRuleDefinitionBuilder = moxProxyHttpRuleDefinitionBuilder;
    }

    @Override
    protected MoxProxyHeaderBuilder createChildBuilder() {
        return new MoxProxyHeaderBuilder(moxProxyHttpRuleDefinitionBuilder,this);
    }


    @Override
    protected List performBuild() throws BuilderValidationException {
        List childBuilders = getItems();
        List headers = new ArrayList<>();

        childBuilders.forEach(item -> {
            if(null != item.getName()){
                headers.add(item.build());
            }
        });
        return headers;
    }

    @Override
    protected MoxProxyHeadersCollectionBuilder getCurrentBuilder() {
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy