1 package org
.asamk
.signal
.manager
.api
;
3 import org
.asamk
.signal
.manager
.storage
.recipients
.Contact
;
4 import org
.asamk
.signal
.manager
.storage
.recipients
.Profile
;
5 import org
.asamk
.signal
.manager
.storage
.recipients
.RecipientId
;
6 import org
.signal
.libsignal
.zkgroup
.profiles
.ExpiringProfileKeyCredential
;
7 import org
.signal
.libsignal
.zkgroup
.profiles
.ProfileKey
;
9 import java
.util
.Objects
;
11 public class Recipient
{
13 private final RecipientId recipientId
;
15 private final RecipientAddress address
;
17 private final Contact contact
;
19 private final ProfileKey profileKey
;
21 private final ExpiringProfileKeyCredential expiringProfileKeyCredential
;
23 private final Profile profile
;
26 final RecipientId recipientId
,
27 final RecipientAddress address
,
28 final Contact contact
,
29 final ProfileKey profileKey
,
30 final ExpiringProfileKeyCredential expiringProfileKeyCredential
,
33 this.recipientId
= recipientId
;
34 this.address
= address
;
35 this.contact
= contact
;
36 this.profileKey
= profileKey
;
37 this.expiringProfileKeyCredential
= expiringProfileKeyCredential
;
38 this.profile
= profile
;
41 private Recipient(final Builder builder
) {
42 recipientId
= builder
.recipientId
;
43 address
= builder
.address
;
44 contact
= builder
.contact
;
45 profileKey
= builder
.profileKey
;
46 expiringProfileKeyCredential
= builder
.expiringProfileKeyCredential1
;
47 profile
= builder
.profile
;
50 public static Builder
newBuilder() {
54 public static Builder
newBuilder(final Recipient copy
) {
55 Builder builder
= new Builder();
56 builder
.recipientId
= copy
.getRecipientId();
57 builder
.address
= copy
.getAddress();
58 builder
.contact
= copy
.getContact();
59 builder
.profileKey
= copy
.getProfileKey();
60 builder
.expiringProfileKeyCredential1
= copy
.getExpiringProfileKeyCredential();
61 builder
.profile
= copy
.getProfile();
65 public RecipientId
getRecipientId() {
69 public RecipientAddress
getAddress() {
73 public Contact
getContact() {
77 public ProfileKey
getProfileKey() {
81 public ExpiringProfileKeyCredential
getExpiringProfileKeyCredential() {
82 return expiringProfileKeyCredential
;
85 public Profile
getProfile() {
90 public boolean equals(final Object o
) {
91 if (this == o
) return true;
92 if (o
== null || getClass() != o
.getClass()) return false;
93 final Recipient recipient
= (Recipient
) o
;
94 return Objects
.equals(recipientId
, recipient
.recipientId
)
95 && Objects
.equals(address
, recipient
.address
)
96 && Objects
.equals(contact
, recipient
.contact
)
97 && Objects
.equals(profileKey
, recipient
.profileKey
)
98 && Objects
.equals(expiringProfileKeyCredential
, recipient
.expiringProfileKeyCredential
)
99 && Objects
.equals(profile
, recipient
.profile
);
103 public int hashCode() {
104 return Objects
.hash(recipientId
, address
, contact
, profileKey
, expiringProfileKeyCredential
, profile
);
107 public static final class Builder
{
109 private RecipientId recipientId
;
110 private RecipientAddress address
;
111 private Contact contact
;
112 private ProfileKey profileKey
;
113 private ExpiringProfileKeyCredential expiringProfileKeyCredential1
;
114 private Profile profile
;
119 public Builder
withRecipientId(final RecipientId val
) {
124 public Builder
withAddress(final RecipientAddress val
) {
129 public Builder
withContact(final Contact val
) {
134 public Builder
withProfileKey(final ProfileKey val
) {
139 public Builder
withExpiringProfileKeyCredential(final ExpiringProfileKeyCredential val
) {
140 expiringProfileKeyCredential1
= val
;
144 public Builder
withProfile(final Profile val
) {
149 public Recipient
build() {
150 return new Recipient(this);