You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.9 KiB
74 lines
1.9 KiB
6 years ago
|
package com.fr.plugin.db.redis.core;
|
||
|
|
||
|
import com.fr.config.holder.Conf;
|
||
|
import com.fr.config.holder.factory.Holders;
|
||
|
import com.fr.config.utils.UniqueKey;
|
||
|
import com.fr.stable.AssistUtils;
|
||
|
import com.fr.stable.StringUtils;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019-03-22
|
||
|
*/
|
||
|
public class RedisNode extends UniqueKey {
|
||
|
|
||
|
public static final int DEFAULT_REDIS_PORT = 6379;
|
||
|
|
||
|
private Conf<String> host = Holders.simple(StringUtils.EMPTY);
|
||
|
private Conf<Integer> port = Holders.simple(DEFAULT_REDIS_PORT);
|
||
|
private Conf<String> password = Holders.simple(StringUtils.EMPTY);
|
||
|
|
||
|
public RedisNode(String host, int port, String password) {
|
||
|
this.setHost(host);
|
||
|
this.setPort(port);
|
||
|
this.setPassword(password);
|
||
|
}
|
||
|
|
||
|
public String getHost() {
|
||
|
return host.get();
|
||
|
}
|
||
|
|
||
|
public void setHost(String host) {
|
||
|
this.host.set(host);
|
||
|
}
|
||
|
|
||
|
public int getPort() {
|
||
|
return port.get();
|
||
|
}
|
||
|
|
||
|
public void setPort(int port) {
|
||
|
this.port.set(port);
|
||
|
}
|
||
|
|
||
|
public String getPassword() {
|
||
|
return password.get();
|
||
|
}
|
||
|
|
||
|
public void setPassword(String password) {
|
||
|
this.password.set(password);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean equals(Object obj) {
|
||
|
return obj instanceof RedisNode
|
||
|
&& AssistUtils.equals(((RedisNode) obj).getHost(), getHost())
|
||
|
&& ((RedisNode) obj).getPort() == getPort()
|
||
|
&& AssistUtils.equals(((RedisNode) obj).getPassword(), getPassword());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int hashCode() {
|
||
|
return AssistUtils.hashCode(getHost(), getPort(), getPassword());
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Object clone() throws CloneNotSupportedException {
|
||
|
RedisNode cloned = (RedisNode) super.clone();
|
||
|
cloned.host = (Conf<String>) host.clone();
|
||
|
cloned.port = (Conf<Integer>) port.clone();
|
||
|
cloned.password = (Conf<String>) password.clone();
|
||
|
return cloned;
|
||
|
}
|
||
|
}
|