]> nmode's Git Repositories - signal-cli/blob - lib/src/main/java/org/asamk/signal/manager/storage/recipients/Recipient.java
3ccf8210242276bebb308262284516c35f2b4c51
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / storage / recipients / Recipient.java
1 package org.asamk.signal.manager.storage.recipients;
2
3 import org.signal.zkgroup.profiles.ProfileKey;
4 import org.signal.zkgroup.profiles.ProfileKeyCredential;
5 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
6
7 public class Recipient {
8
9 private final RecipientId recipientId;
10
11 private final SignalServiceAddress address;
12
13 private final Contact contact;
14
15 private final ProfileKey profileKey;
16
17 private final ProfileKeyCredential profileKeyCredential;
18
19 private final Profile profile;
20
21 public Recipient(
22 final RecipientId recipientId,
23 final SignalServiceAddress address,
24 final Contact contact,
25 final ProfileKey profileKey,
26 final ProfileKeyCredential profileKeyCredential,
27 final Profile profile
28 ) {
29 this.recipientId = recipientId;
30 this.address = address;
31 this.contact = contact;
32 this.profileKey = profileKey;
33 this.profileKeyCredential = profileKeyCredential;
34 this.profile = profile;
35 }
36
37 private Recipient(final Builder builder) {
38 recipientId = builder.recipientId;
39 address = builder.address;
40 contact = builder.contact;
41 profileKey = builder.profileKey;
42 profileKeyCredential = builder.profileKeyCredential;
43 profile = builder.profile;
44 }
45
46 public static Builder newBuilder() {
47 return new Builder();
48 }
49
50 public static Builder newBuilder(final Recipient copy) {
51 Builder builder = new Builder();
52 builder.recipientId = copy.getRecipientId();
53 builder.address = copy.getAddress();
54 builder.contact = copy.getContact();
55 builder.profileKey = copy.getProfileKey();
56 builder.profileKeyCredential = copy.getProfileKeyCredential();
57 builder.profile = copy.getProfile();
58 return builder;
59 }
60
61 public RecipientId getRecipientId() {
62 return recipientId;
63 }
64
65 public SignalServiceAddress getAddress() {
66 return address;
67 }
68
69 public Contact getContact() {
70 return contact;
71 }
72
73 public ProfileKey getProfileKey() {
74 return profileKey;
75 }
76
77 public ProfileKeyCredential getProfileKeyCredential() {
78 return profileKeyCredential;
79 }
80
81 public Profile getProfile() {
82 return profile;
83 }
84
85 public static final class Builder {
86
87 private RecipientId recipientId;
88 private SignalServiceAddress address;
89 private Contact contact;
90 private ProfileKey profileKey;
91 private ProfileKeyCredential profileKeyCredential;
92 private Profile profile;
93
94 private Builder() {
95 }
96
97 public Builder withRecipientId(final RecipientId val) {
98 recipientId = val;
99 return this;
100 }
101
102 public Builder withAddress(final SignalServiceAddress val) {
103 address = val;
104 return this;
105 }
106
107 public Builder withContact(final Contact val) {
108 contact = val;
109 return this;
110 }
111
112 public Builder withProfileKey(final ProfileKey val) {
113 profileKey = val;
114 return this;
115 }
116
117 public Builder withProfileKeyCredential(final ProfileKeyCredential val) {
118 profileKeyCredential = val;
119 return this;
120 }
121
122 public Builder withProfile(final Profile val) {
123 profile = val;
124 return this;
125 }
126
127 public Recipient build() {
128 return new Recipient(this);
129 }
130 }
131 }