Convert RecipientAddress to record

This commit is contained in:
AsamK 2021-12-06 18:55:37 +01:00
parent c3a9022bec
commit 8867a7b9ee
14 changed files with 59 additions and 91 deletions

View file

@ -43,8 +43,8 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
final var jsonContacts = contacts.stream().map(contactPair -> {
final var address = contactPair.first();
final var contact = contactPair.second();
return new JsonContact(address.getNumber().orElse(null),
address.getUuid().map(UUID::toString).orElse(null),
return new JsonContact(address.number().orElse(null),
address.uuid().map(UUID::toString).orElse(null),
contact.getName(),
contact.isBlocked(),
contact.getMessageExpirationTime());

View file

@ -41,8 +41,8 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
private static Set<JsonGroupMember> resolveJsonMembers(Set<RecipientAddress> addresses) {
return addresses.stream()
.map(address -> new JsonGroupMember(address.getNumber().orElse(null),
address.getUuid().map(UUID::toString).orElse(null)))
.map(address -> new JsonGroupMember(address.number().orElse(null),
address.uuid().map(UUID::toString).orElse(null)))
.collect(Collectors.toSet());
}

View file

@ -31,7 +31,7 @@ public class ListIdentitiesCommand implements JsonRpcLocalCommand {
private static void printIdentityFingerprint(PlainTextWriter writer, Identity theirId) {
writer.println("{}: {} Added: {} Fingerprint: {} Safety Number: {}",
theirId.recipient().getNumber().orElse(null),
theirId.recipient().number().orElse(null),
theirId.trustLevel(),
theirId.dateAdded(),
Hex.toString(theirId.getFingerprint()),
@ -67,8 +67,8 @@ public class ListIdentitiesCommand implements JsonRpcLocalCommand {
final var address = id.recipient();
var safetyNumber = Util.formatSafetyNumber(id.safetyNumber());
var scannableSafetyNumber = id.scannableSafetyNumber();
return new JsonIdentity(address.getNumber().orElse(null),
address.getUuid().map(UUID::toString).orElse(null),
return new JsonIdentity(address.number().orElse(null),
address.uuid().map(UUID::toString).orElse(null),
Hex.toString(id.getFingerprint()),
safetyNumber,
scannableSafetyNumber == null