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