1 package org
.asamk
.signal
.manager
.storage
.recipients
;
3 import org
.signal
.libsignal
.zkgroup
.profiles
.ExpiringProfileKeyCredential
;
4 import org
.signal
.libsignal
.zkgroup
.profiles
.ProfileKey
;
6 import java
.util
.Objects
;
8 public class Recipient
{
10 private final RecipientId recipientId
;
12 private final RecipientAddress address
;
14 private final Contact contact
;
16 private final ProfileKey profileKey
;
18 private final ExpiringProfileKeyCredential expiringProfileKeyCredential
;
20 private final Profile profile
;
23 final RecipientId recipientId
,
24 final RecipientAddress address
,
25 final Contact contact
,
26 final ProfileKey profileKey
,
27 final ExpiringProfileKeyCredential expiringProfileKeyCredential
,
30 this.recipientId
= recipientId
;
31 this.address
= address
;
32 this.contact
= contact
;
33 this.profileKey
= profileKey
;
34 this.expiringProfileKeyCredential
= expiringProfileKeyCredential
;
35 this.profile
= profile
;
38 private Recipient(final Builder builder
) {
39 recipientId
= builder
.recipientId
;
40 address
= builder
.address
;
41 contact
= builder
.contact
;
42 profileKey
= builder
.profileKey
;
43 expiringProfileKeyCredential
= builder
.expiringProfileKeyCredential1
;
44 profile
= builder
.profile
;
47 public static Builder
newBuilder() {
51 public static Builder
newBuilder(final Recipient copy
) {
52 Builder builder
= new Builder();
53 builder
.recipientId
= copy
.getRecipientId();
54 builder
.address
= copy
.getAddress();
55 builder
.contact
= copy
.getContact();
56 builder
.profileKey
= copy
.getProfileKey();
57 builder
.expiringProfileKeyCredential1
= copy
.getExpiringProfileKeyCredential();
58 builder
.profile
= copy
.getProfile();
62 public RecipientId
getRecipientId() {
66 public RecipientAddress
getAddress() {
70 public Contact
getContact() {
74 public ProfileKey
getProfileKey() {
78 public ExpiringProfileKeyCredential
getExpiringProfileKeyCredential() {
79 return expiringProfileKeyCredential
;
82 public Profile
getProfile() {
87 public boolean equals(final Object o
) {
88 if (this == o
) return true;
89 if (o
== null || getClass() != o
.getClass()) return false;
90 final Recipient recipient
= (Recipient
) o
;
91 return Objects
.equals(recipientId
, recipient
.recipientId
)
92 && Objects
.equals(address
, recipient
.address
)
93 && Objects
.equals(contact
, recipient
.contact
)
94 && Objects
.equals(profileKey
, recipient
.profileKey
)
95 && Objects
.equals(expiringProfileKeyCredential
, recipient
.expiringProfileKeyCredential
)
96 && Objects
.equals(profile
, recipient
.profile
);
100 public int hashCode() {
101 return Objects
.hash(recipientId
, address
, contact
, profileKey
, expiringProfileKeyCredential
, profile
);
104 public static final class Builder
{
106 private RecipientId recipientId
;
107 private RecipientAddress address
;
108 private Contact contact
;
109 private ProfileKey profileKey
;
110 private ExpiringProfileKeyCredential expiringProfileKeyCredential1
;
111 private Profile profile
;
116 public Builder
withRecipientId(final RecipientId val
) {
121 public Builder
withAddress(final RecipientAddress val
) {
126 public Builder
withContact(final Contact val
) {
131 public Builder
withProfileKey(final ProfileKey val
) {
136 public Builder
withExpiringProfileKeyCredential(final ExpiringProfileKeyCredential val
) {
137 expiringProfileKeyCredential1
= val
;
141 public Builder
withProfile(final Profile val
) {
146 public Recipient
build() {
147 return new Recipient(this);