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

com.ecwid.consul.v1.NodeMetaParameters Maven / Gradle / Ivy

The newest version!
package com.ecwid.consul.v1;

import com.ecwid.consul.UrlParameters;

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

public class NodeMetaParameters implements UrlParameters {

    private final Map nodeMeta;

    public NodeMetaParameters(Map nodeMeta) {
        this.nodeMeta = nodeMeta;
    }

    @Override
    public List toUrlParameters() {
        List params = new ArrayList<>();

        if (nodeMeta != null) {
            String key = "node-meta";

            for (Map.Entry entry : nodeMeta.entrySet()) {
                String value = entry.getKey() + ":" + entry.getValue();
                params.add(key + "=" + value);
            }
        }

        return params;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy