com.ecwid.consul.SingleUrlParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of consul-api Show documentation
Show all versions of consul-api Show documentation
Java client for Consul HTTP API (http://consul.io)
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);
}
}
}