io.tarantool.driver.cluster.HTTPClusterDiscoveryEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cartridge-driver Show documentation
Show all versions of cartridge-driver Show documentation
Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework
package io.tarantool.driver.cluster;
import io.tarantool.driver.utils.Assert;
/**
* Class-container for {@link HTTPDiscoveryClusterAddressProvider} configuration
*
* @author Sergey Volgin
*/
public class HTTPClusterDiscoveryEndpoint implements TarantoolClusterDiscoveryEndpoint {
private String uri;
/**
* Create an instance
*/
public HTTPClusterDiscoveryEndpoint() {
}
/**
* Create an instance, specifying URI for connection
* @param uri discovery endpoint URI
*/
public HTTPClusterDiscoveryEndpoint(String uri) {
this.uri = uri;
}
/**
* Get discovery endpoint URI
* @return discovery endpoint URI
*/
public String getUri() {
return uri;
}
/**
* Set discovery endpoint URI
* @param uri discovery endpoint URI
*/
public void setUri(String uri) {
this.uri = uri;
}
/**
* Builder for {@link HTTPClusterDiscoveryEndpoint}
*/
public static class Builder {
private HTTPClusterDiscoveryEndpoint endpoint;
/**
* Basic constructor.
*/
public Builder() {
this.endpoint = new HTTPClusterDiscoveryEndpoint();
}
/**
* Specify the cluster discovery endpoint URI
* @param uri discovery endpoint URI, should not be null or empty
* @return this builder instance
*/
public Builder withURI(String uri) {
Assert.hasText(uri, "The discovery endpoint URI should not be null or empty");
this.endpoint.setUri(uri);
return this;
}
/**
* Build the discovery endpoint configuration
* @return a {@link HTTPClusterDiscoveryEndpoint} instance
*/
public HTTPClusterDiscoveryEndpoint build() {
return endpoint;
}
}
}