mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
58 lines
1.2 KiB
Java
58 lines
1.2 KiB
Java
package org.thoughtcrime.securesms.attachments;
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import org.thoughtcrime.securesms.util.Util;
|
|
|
|
public class AttachmentId {
|
|
|
|
@JsonProperty
|
|
private final long rowId;
|
|
|
|
@JsonProperty
|
|
private final long uniqueId;
|
|
|
|
public AttachmentId(@JsonProperty("rowId") long rowId, @JsonProperty("uniqueId") long uniqueId) {
|
|
this.rowId = rowId;
|
|
this.uniqueId = uniqueId;
|
|
}
|
|
|
|
public long getRowId() {
|
|
return rowId;
|
|
}
|
|
|
|
public long getUniqueId() {
|
|
return uniqueId;
|
|
}
|
|
|
|
public String[] toStrings() {
|
|
return new String[] {String.valueOf(rowId), String.valueOf(uniqueId)};
|
|
}
|
|
|
|
public @NonNull String toString() {
|
|
return "(row id: " + rowId + ", unique ID: " + uniqueId + ")";
|
|
}
|
|
|
|
public boolean isValid() {
|
|
return rowId >= 0 && uniqueId >= 0;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) return true;
|
|
if (o == null || getClass() != o.getClass()) return false;
|
|
|
|
AttachmentId attachmentId = (AttachmentId)o;
|
|
|
|
if (rowId != attachmentId.rowId) return false;
|
|
return uniqueId == attachmentId.uniqueId;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Util.hashCode(rowId, uniqueId);
|
|
}
|
|
}
|