org.zodiac.sentinel.base.config.SentinelConfigInfo Maven / Gradle / Ivy
The newest version!
package org.zodiac.sentinel.base.config;
import java.util.Map;
import java.util.Objects;
import org.zodiac.sdk.toolkit.util.collection.CollUtil;
import org.zodiac.sentinel.base.config.web.SentinelHttpInfo;
public class SentinelConfigInfo {
/**
* Earlier initialize heart-beat when the spring container starts when the transport
* dependency is on classpath, the configuration is effective.
*/
private boolean eager = false;
/**
* Enable sentinel auto configure, the default value is true.
*/
private boolean enabled = true;
/**
* The process page when the flow control is triggered.
*/
private String blockPage;
private Map datasource = CollUtil.treeMap(String.CASE_INSENSITIVE_ORDER);
private final SentinelLogInfo log = new SentinelLogInfo();
private final SentinelTransportInfo transport = new SentinelTransportInfo();
private final SentinelMetricInfo metric = new SentinelMetricInfo();
private final SentinelFlowInfo flow = new SentinelFlowInfo();
private final SentinelHttpInfo http = new SentinelHttpInfo();
public SentinelConfigInfo() {
super();
}
public boolean isEager() {
return eager;
}
public void setEager(boolean eager) {
this.eager = eager;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getBlockPage() {
return blockPage;
}
public void setBlockPage(String blockPage) {
this.blockPage = blockPage;
}
public Map getDatasource() {
return datasource;
}
public void setDatasource(Map datasource) {
this.datasource = datasource;
}
public SentinelLogInfo getLog() {
return log;
}
public SentinelTransportInfo getTransport() {
return transport;
}
public SentinelMetricInfo getMetric() {
return metric;
}
public SentinelFlowInfo getFlow() {
return flow;
}
public SentinelHttpInfo getHttp() {
return http;
}
@Override
public int hashCode() {
return Objects.hash(blockPage, datasource, eager, enabled, flow, http, log, metric, transport);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SentinelConfigInfo other = (SentinelConfigInfo)obj;
return Objects.equals(blockPage, other.blockPage) && Objects.equals(datasource, other.datasource)
&& eager == other.eager && enabled == other.enabled && Objects.equals(flow, other.flow)
&& Objects.equals(http, other.http) && Objects.equals(log, other.log)
&& Objects.equals(metric, other.metric) && Objects.equals(transport, other.transport);
}
@Override
public String toString() {
return "SentinelConfigInfo [eager=" + eager + ", enabled=" + enabled + ", blockPage=" + blockPage
+ ", datasource=" + datasource + ", log=" + log + ", transport=" + transport + ", metric=" + metric
+ ", flow=" + flow + ", http=" + http + "]";
}
}