com.distelli.persistence.IndexKey Maven / Gradle / Ivy
package com.distelli.persistence;
import java.util.Arrays;
import java.util.Objects;
public class IndexKey {
protected Object hashKey = null;
protected Object rangeKey = null;
public void setHashKey(Object hashKey)
{
this.hashKey = hashKey;
}
public Object getHashKey()
{
return this.hashKey;
}
public IndexKey withHashKey(Object hashKey)
{
this.hashKey = hashKey;
return this;
}
public void setRangeKey(Object rangeKey)
{
this.rangeKey = rangeKey;
}
public Object getRangeKey()
{
return this.rangeKey;
}
public IndexKey withRangeKey(Object rangeKey)
{
this.rangeKey = rangeKey;
return this;
}
@Override
public String toString() {
return String.format("IndexKey[hashKey=%s, rangeKey=%s]", hashKey, rangeKey);
}
@Override
public boolean equals(Object obj) {
if ( null == obj || ! getClass().equals(obj.getClass()) ) return false;
IndexKey other = (IndexKey)obj;
return Objects.deepEquals(hashKey, other.hashKey) &&
Objects.deepEquals(rangeKey, other.rangeKey);
}
@Override
public int hashCode() {
return Arrays.deepHashCode(new Object[]{hashKey, rangeKey});
}
}