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

net.klakegg.pkix.ocsp.builder.Builder Maven / Gradle / Ivy

package net.klakegg.pkix.ocsp.builder;

import java.util.HashMap;
import java.util.Map;

/**
 * @author erlend
 */
public class Builder {

    protected BuildHandler buildHandler;

    protected Map, Object> map = new HashMap<>();

    public Builder(BuildHandler buildHandler) {
        this(buildHandler, new HashMap, Object>());
    }

    private Builder(BuildHandler buildHandler, Map, Object> map) {
        this.buildHandler = buildHandler;
        this.map = map;
    }

    public  Builder set(Property property, S value) {
        Map, Object> map = new HashMap<>(this.map);
        map.put(property, value);

        return new Builder<>(buildHandler, map);
    }

    public T build() {
        return buildHandler.build(new Properties(map));
    }
}