
commons.box.app.SerialKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-box-app Show documentation
Show all versions of commons-box-app Show documentation
Common utils for BOX projects.
The newest version!
package commons.box.app;
import commons.box.util.Types;
import java.io.Serializable;
import java.util.Arrays;
/**
* 可序列化的 组合key 实现,基于 Safe Key 但本类支持序列化,同样送入参数也必须符合序列化标桩
*/
public class SerialKey implements Serializable {
private final Serializable[] objs;
private final int hc;
public SerialKey(Serializable... objs) {
this.objs = (objs != null) ? objs : new Serializable[]{};
this.hc = Types.hc(this.objs);
}
public Serializable[] objs() {
return objs;
}
public int hc() {
return hc;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SerialKey qCacheKey = (SerialKey) o;
return Arrays.deepEquals(objs, qCacheKey.objs);
}
@Override
public int hashCode() {
return this.hc;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy