![JAR search and dependency download from the Maven repository](/logo.png)
shz.core.lock.Key Maven / Gradle / Ivy
package shz.core.lock;
import shz.core.NullHelp;
import shz.core.ToString;
import java.util.concurrent.TimeUnit;
public final class Key {
private String key;
private Object value;
private long time;
private TimeUnit unit = TimeUnit.MILLISECONDS;
public Key() {
}
public Key(String key, Object value) {
this.key = NullHelp.requireNonBlank(key);
this.value = value;
}
public static Key of(Object key, Object value) {
return new Key(ToString.normal(key), value);
}
public Key time(long time) {
this.time = time;
return this;
}
public Key unit(TimeUnit unit) {
this.unit = unit;
return this;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = NullHelp.requireNonBlank(key);
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
public TimeUnit getUnit() {
return unit;
}
public void setUnit(TimeUnit unit) {
this.unit = unit;
}
@Override
public String toString() {
return "Key{" +
"key='" + key + '\'' +
", value=" + value +
", time=" + time +
", unit=" + unit +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy