package com.qianwen.core.sequence.properties;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.stereotype.Component;
|
|
@ConfigurationProperties(prefix = "blade.xsequence.snowflake")
|
@Component
|
|
public class SequenceSnowflakeProperties extends BaseSequenceProperties {
|
private long datacenterId;
|
private long workerId;
|
|
public void setDatacenterId(final long datacenterId) {
|
this.datacenterId = datacenterId;
|
}
|
|
public void setWorkerId(final long workerId) {
|
this.workerId = workerId;
|
}
|
|
@Override // com.qianwen.core.sequence.properties.BaseSequenceProperties
|
public boolean equals(final Object o) {
|
if (o == this) {
|
return true;
|
}
|
if (o instanceof SequenceSnowflakeProperties) {
|
SequenceSnowflakeProperties other = (SequenceSnowflakeProperties) o;
|
return other.canEqual(this) && getDatacenterId() == other.getDatacenterId() && getWorkerId() == other.getWorkerId();
|
}
|
return false;
|
}
|
|
@Override // com.qianwen.core.sequence.properties.BaseSequenceProperties
|
protected boolean canEqual(final Object other) {
|
return other instanceof SequenceSnowflakeProperties;
|
}
|
|
@Override // com.qianwen.core.sequence.properties.BaseSequenceProperties
|
public int hashCode() {
|
long $datacenterId = getDatacenterId();
|
int result = (1 * 59) + ((int) (($datacenterId >>> 32) ^ $datacenterId));
|
long $workerId = getWorkerId();
|
return (result * 59) + ((int) (($workerId >>> 32) ^ $workerId));
|
}
|
|
@Override // com.qianwen.core.sequence.properties.BaseSequenceProperties
|
public String toString() {
|
return "SequenceSnowflakeProperties(datacenterId=" + getDatacenterId() + ", workerId=" + getWorkerId() + ")";
|
}
|
|
public long getDatacenterId() {
|
return this.datacenterId;
|
}
|
|
public long getWorkerId() {
|
return this.workerId;
|
}
|
}
|