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

moxproxy.builders.MoxProxyHeaderBuilder Maven / Gradle / Ivy

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

import moxproxy.model.MoxProxyHeader;

public class MoxProxyHeaderBuilder extends BaseBuilder {

    private String name;

    private Object value;

    private MoxProxyHeadersCollectionBuilder moxProxyHeadersCollectionBuilder;

    MoxProxyHeaderBuilder(MoxProxyHttpRuleDefinitionBuilder moxProxyHttpRuleDefinitionBuilder, MoxProxyHeadersCollectionBuilder moxProxyHeadersCollectionBuilder) {
        super(moxProxyHttpRuleDefinitionBuilder, new MoxProxyHeaderBuilderValidator());
        this.moxProxyHeadersCollectionBuilder = moxProxyHeadersCollectionBuilder;
    }

    public MoxProxyHeaderBuilder withHeader(String name, Object value){
        this.name = name;
        this.value = value;
        return moxProxyHeadersCollectionBuilder.addItem();
    }

    String getName() {
        return name;
    }

    Object getValue() {
        return value;
    }

    @Override
    protected MoxProxyHeader performBuild() {
        MoxProxyHeader header = new MoxProxyHeader();
        header.setName(name);
        header.setValue(value);
        return header;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy