com.yy.httpdns.bean.DomainName Maven / Gradle / Ivy
package com.yy.httpdns.bean;
/**
* Created by huangzhilong on 2016/8/16.
*/
public class DomainName {
private long interval;
private long lastDnsTime = 0;
private String headerHost;
private String hostName;
private String api;
private int port;
private String protocol;
@Override
public String toString() {
return "DomainName{" +
"interval=" + interval +
", lastDnsTime=" + lastDnsTime +
", headerHost='" + headerHost + '\'' +
", hostName='" + hostName + '\'' +
", api='" + api + '\'' +
", port=" + port +
", protocol='" + protocol + '\'' +
'}';
}
/**
*
* @param hostName use get ipList param
* @param protocol
* @param api
* @param port
* @param headerHost use speedTest header param
*/
public DomainName(String hostName, String protocol, String api, int port, String headerHost) {
this.hostName = hostName;
this.protocol = protocol;
this.api = api;
this.port = port;
this.headerHost = headerHost;
}
public Long getInterval() {
return interval;
}
public void setInterval(Long interval) {
this.interval = interval;
}
public Long getLastDnsTime() {
return lastDnsTime;
}
public void setLastDnsTime(Long lastDnsTime) {
this.lastDnsTime = lastDnsTime;
}
public String getHostName() {
return hostName;
}
public String getApi() {
return api;
}
public int getPort() {
return port;
}
public String getProtocol() {
return protocol;
}
public String getHeaderHost() {
return headerHost;
}
public boolean checkInterval() {
long nowTime = System.currentTimeMillis();
if(nowTime > this.getInterval() + this.getLastDnsTime()) {
return true;
} else {
return false;
}
}
}