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

com.ecwid.consul.SingleUrlParameters Maven / Gradle / Ivy

The newest version!
package com.ecwid.consul;

import java.util.Collections;
import java.util.List;

/**
 * @author Vasily Vasilkov ([email protected])
 */
public final class SingleUrlParameters implements UrlParameters {

	private final String key;
	private final String value;

	public SingleUrlParameters(String key) {
		this.key = key;
		this.value = null;
	}

	public SingleUrlParameters(String key, String value) {
		this.key = key;
		this.value = value;
	}

	@Override
	public List toUrlParameters() {
		if (value != null) {
			return Collections.singletonList(key + "=" + Utils.encodeValue(value));
		} else {
			return Collections.singletonList(key);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy