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

com.redislabs.picocliredis.Server Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package com.redislabs.picocliredis;

import io.lettuce.core.RedisURI;
import lombok.Data;

public @Data class Server {

	private static final String SEPARATOR = ":";
	public static final String DEFAULT_HOST = "localhost";
	public static final int DEFAULT_PORT = RedisURI.DEFAULT_REDIS_PORT;

	private String host;
	private int port;

	public Server() {
		this.host = DEFAULT_HOST;
		this.port = DEFAULT_PORT;
	}

	public Server(String host, int port) {
		this.host = host;
		this.port = port;
	}

	public Server(String endpoint) {
		this(endpoint.split(SEPARATOR)[0], Integer.parseInt(endpoint.split(SEPARATOR)[1]));
	}

	@Override
	public String toString() {
		return address();
	}

	public String address() {
		return host + SEPARATOR + port;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy