org.zodiac.loadbalancer.ribbon.config.PlatformRibbonRuleInfo Maven / Gradle / Ivy
package org.zodiac.loadbalancer.ribbon.config;
import java.util.List;
import java.util.Objects;
import org.zodiac.sdk.toolkit.util.collection.CollUtil;
public class PlatformRibbonRuleInfo {
/*是否开启。*/
private boolean enabled = true;
/*是否开启服务权重。*/
private boolean weight = false;
/*服务的tag,用于灰度,匹配:“nacos.discovery.metadata.tag”。*/
private String tag;
/*优先的ip列表,支持通配符,例如:“10.20.0.8*”、“10.20.0.*”。*/
private List priorIpPattern = CollUtil.list();
public PlatformRibbonRuleInfo() {
super();
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isWeight() {
return weight;
}
public void setWeight(boolean weight) {
this.weight = weight;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public List getPriorIpPattern() {
return priorIpPattern;
}
public void setPriorIpPattern(List priorIpPattern) {
this.priorIpPattern = priorIpPattern;
}
@Override
public int hashCode() {
return Objects.hash(enabled, priorIpPattern, tag, weight);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PlatformRibbonRuleInfo other = (PlatformRibbonRuleInfo)obj;
return enabled == other.enabled && Objects.equals(priorIpPattern, other.priorIpPattern)
&& Objects.equals(tag, other.tag) && weight == other.weight;
}
@Override
public String toString() {
return "PlatfromRibbonRule [enabled=" + enabled + ", weight=" + weight + ", tag=" + tag
+ ", priorIpPattern=" + priorIpPattern + "]";
}
}