1 package org
.asamk
.signal
.manager
.api
;
3 import org
.asamk
.signal
.manager
.storage
.recipients
.RecipientId
;
4 import org
.signal
.libsignal
.zkgroup
.profiles
.ExpiringProfileKeyCredential
;
5 import org
.signal
.libsignal
.zkgroup
.profiles
.ProfileKey
;
7 import java
.util
.Objects
;
9 public class Recipient
{
11 private final RecipientId recipientId
;
13 private final RecipientAddress address
;
15 private final Contact contact
;
17 private final ProfileKey profileKey
;
19 private final ExpiringProfileKeyCredential expiringProfileKeyCredential
;
21 private final Profile profile
;
24 final RecipientId recipientId
,
25 final RecipientAddress address
,
26 final Contact contact
,
27 final ProfileKey profileKey
,
28 final ExpiringProfileKeyCredential expiringProfileKeyCredential
,
31 this.recipientId
= recipientId
;
32 this.address
= address
;
33 this.contact
= contact
;
34 this.profileKey
= profileKey
;
35 this.expiringProfileKeyCredential
= expiringProfileKeyCredential
;
36 this.profile
= profile
;
39 private Recipient(final Builder builder
) {
40 recipientId
= builder
.recipientId
;
41 address
= builder
.address
;
42 contact
= builder
.contact
;
43 profileKey
= builder
.profileKey
;
44 expiringProfileKeyCredential
= builder
.expiringProfileKeyCredential1
;
45 profile
= builder
.profile
;
48 public static Builder
newBuilder() {
52 public static Builder
newBuilder(final Recipient copy
) {
53 Builder builder
= new Builder();
54 builder
.recipientId
= copy
.getRecipientId();
55 builder
.address
= copy
.getAddress();
56 builder
.contact
= copy
.getContact();
57 builder
.profileKey
= copy
.getProfileKey();
58 builder
.expiringProfileKeyCredential1
= copy
.getExpiringProfileKeyCredential();
59 builder
.profile
= copy
.getProfile();
63 public RecipientId
getRecipientId() {
67 public RecipientAddress
getAddress() {
71 public Contact
getContact() {
75 public ProfileKey
getProfileKey() {
79 public ExpiringProfileKeyCredential
getExpiringProfileKeyCredential() {
80 return expiringProfileKeyCredential
;
83 public Profile
getProfile() {
88 public boolean equals(final Object o
) {
89 if (this == o
) return true;
90 if (o
== null || getClass() != o
.getClass()) return false;
91 final Recipient recipient
= (Recipient
) o
;
92 return Objects
.equals(recipientId
, recipient
.recipientId
)
93 && Objects
.equals(address
, recipient
.address
)
94 && Objects
.equals(contact
, recipient
.contact
)
95 && Objects
.equals(profileKey
, recipient
.profileKey
)
96 && Objects
.equals(expiringProfileKeyCredential
, recipient
.expiringProfileKeyCredential
)
97 && Objects
.equals(profile
, recipient
.profile
);
101 public int hashCode() {
102 return Objects
.hash(recipientId
, address
, contact
, profileKey
, expiringProfileKeyCredential
, profile
);
105 public static final class Builder
{
107 private RecipientId recipientId
;
108 private RecipientAddress address
;
109 private Contact contact
;
110 private ProfileKey profileKey
;
111 private ExpiringProfileKeyCredential expiringProfileKeyCredential1
;
112 private Profile profile
;
117 public Builder
withRecipientId(final RecipientId val
) {
122 public Builder
withAddress(final RecipientAddress val
) {
127 public Builder
withContact(final Contact val
) {
132 public Builder
withProfileKey(final ProfileKey val
) {
137 public Builder
withExpiringProfileKeyCredential(final ExpiringProfileKeyCredential val
) {
138 expiringProfileKeyCredential1
= val
;
142 public Builder
withProfile(final Profile val
) {
147 public Recipient
build() {
148 return new Recipient(this);