io.elsci.mocks.instanceinfo.InstanceInfo Maven / Gradle / Ivy
package io.elsci.mocks.instanceinfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import java.util.UUID;
class InstanceInfo {
private final String version;
private final String commit;
/**
* @see ActiveInstanceChecker
*/
private final String instanceId;
public InstanceInfo(String version, String commit) {
this.version = version;
this.commit = commit;
this.instanceId = UUID.randomUUID().toString();
}
/**
* Used only when deserializing from JSON in {@link ActiveInstanceChecker}.
*/
private InstanceInfo(@JsonProperty("version") String version,
@JsonProperty("commit") String commit,
@JsonProperty("instanceId") String instanceId) {
this.version = version;
this.commit = commit;
this.instanceId = instanceId;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof InstanceInfo other) {
return instanceId.equals(other.instanceId);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(instanceId);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy