com.redislabs.picocliredis.Server Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of picocli-redis Show documentation
Show all versions of picocli-redis Show documentation
Picocli configuration for Redis
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