com.github.javaclub.configcenter.client.domain.CfgVO Maven / Gradle / Ivy
The newest version!
package com.github.javaclub.configcenter.client.domain;
import java.util.Date;
import com.github.javaclub.toolbox.ToolBox.Numbers;
import com.github.javaclub.toolbox.ToolBox.Strings;
import com.github.javaclub.toolbox.utils.ThreadLocalDateFormatter;
/**
* Client端 配置项副本
*/
public class CfgVO {
public String configkey;
public String configvalue;
public String timestamp; // mills
public CfgVO() {
}
public CfgVO(String configkey, String configvalue, String timestamp) {
this.configkey = configkey;
this.configvalue = configvalue;
this.timestamp = timestamp;
}
public boolean isRecentlyFreshed() {
Long mills = Numbers.parseLong(timestamp);
return null != mills && (System.currentTimeMillis() - mills) < 30*1000L;
}
public boolean isMarkedRemoved() {
return Strings.equals(ConfigChangedEvent.REMOVED_FLAG_TIMESTAMP, getTimestamp());
}
public String getConfigkey() {
return configkey;
}
public void setConfigkey(String configkey) {
this.configkey = configkey;
}
public String getConfigvalue() {
return configvalue;
}
public void setConfigvalue(String configvalue) {
this.configvalue = configvalue;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String parseTimestamp() {
return ThreadLocalDateFormatter.timestampFormat(new Date(Numbers.parseLong(timestamp)));
}
@Override
public String toString() {
return "CfgVO [configkey=" + configkey + ", configvalue=" + configvalue + ", timestamp=" + timestamp + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy