1 package org
.asamk
.signal
.manager
.storage
.recipients
;
3 import org
.asamk
.signal
.manager
.api
.Contact
;
4 import org
.asamk
.signal
.manager
.api
.Profile
;
5 import org
.signal
.libsignal
.zkgroup
.profiles
.ExpiringProfileKeyCredential
;
6 import org
.signal
.libsignal
.zkgroup
.profiles
.ProfileKey
;
8 import java
.util
.Objects
;
10 public class Recipient
{
12 private final RecipientId recipientId
;
14 private final RecipientAddress address
;
16 private final Contact contact
;
18 private final ProfileKey profileKey
;
20 private final ExpiringProfileKeyCredential expiringProfileKeyCredential
;
22 private final Profile profile
;
25 final RecipientId recipientId
,
26 final RecipientAddress address
,
27 final Contact contact
,
28 final ProfileKey profileKey
,
29 final ExpiringProfileKeyCredential expiringProfileKeyCredential
,
32 this.recipientId
= recipientId
;
33 this.address
= address
;
34 this.contact
= contact
;
35 this.profileKey
= profileKey
;
36 this.expiringProfileKeyCredential
= expiringProfileKeyCredential
;
37 this.profile
= profile
;
40 private Recipient(final Builder builder
) {
41 recipientId
= builder
.recipientId
;
42 address
= builder
.address
;
43 contact
= builder
.contact
;
44 profileKey
= builder
.profileKey
;
45 expiringProfileKeyCredential
= builder
.expiringProfileKeyCredential1
;
46 profile
= builder
.profile
;
49 public static Builder
newBuilder() {
53 public static Builder
newBuilder(final Recipient copy
) {
54 Builder builder
= new Builder();
55 builder
.recipientId
= copy
.getRecipientId();
56 builder
.address
= copy
.getAddress();
57 builder
.contact
= copy
.getContact();
58 builder
.profileKey
= copy
.getProfileKey();
59 builder
.expiringProfileKeyCredential1
= copy
.getExpiringProfileKeyCredential();
60 builder
.profile
= copy
.getProfile();
64 public RecipientId
getRecipientId() {
68 public RecipientAddress
getAddress() {
72 public Contact
getContact() {
76 public ProfileKey
getProfileKey() {
80 public ExpiringProfileKeyCredential
getExpiringProfileKeyCredential() {
81 return expiringProfileKeyCredential
;
84 public Profile
getProfile() {
89 public boolean equals(final Object o
) {
90 if (this == o
) return true;
91 if (o
== null || getClass() != o
.getClass()) return false;
92 final Recipient recipient
= (Recipient
) o
;
93 return Objects
.equals(recipientId
, recipient
.recipientId
)
94 && Objects
.equals(address
, recipient
.address
)
95 && Objects
.equals(contact
, recipient
.contact
)
96 && Objects
.equals(profileKey
, recipient
.profileKey
)
97 && Objects
.equals(expiringProfileKeyCredential
, recipient
.expiringProfileKeyCredential
)
98 && Objects
.equals(profile
, recipient
.profile
);
102 public int hashCode() {
103 return Objects
.hash(recipientId
, address
, contact
, profileKey
, expiringProfileKeyCredential
, profile
);
106 public static final class Builder
{
108 private RecipientId recipientId
;
109 private RecipientAddress address
;
110 private Contact contact
;
111 private ProfileKey profileKey
;
112 private ExpiringProfileKeyCredential expiringProfileKeyCredential1
;
113 private Profile profile
;
118 public Builder
withRecipientId(final RecipientId val
) {
123 public Builder
withAddress(final RecipientAddress val
) {
128 public Builder
withContact(final Contact val
) {
133 public Builder
withProfileKey(final ProfileKey val
) {
138 public Builder
withExpiringProfileKeyCredential(final ExpiringProfileKeyCredential val
) {
139 expiringProfileKeyCredential1
= val
;
143 public Builder
withProfile(final Profile val
) {
148 public Recipient
build() {
149 return new Recipient(this);