mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Use record classes
This commit is contained in:
parent
ce70a623c2
commit
ce7aa580b6
66 changed files with 754 additions and 1877 deletions
|
@ -1,24 +1,11 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.messages.shared.SharedContact;
|
||||
|
||||
public class JsonContactPhone {
|
||||
public record JsonContactPhone(String value, SharedContact.Phone.Type type, String label) {
|
||||
|
||||
@JsonProperty
|
||||
private final String value;
|
||||
|
||||
@JsonProperty
|
||||
private final SharedContact.Phone.Type type;
|
||||
|
||||
@JsonProperty
|
||||
private final String label;
|
||||
|
||||
public JsonContactPhone(SharedContact.Phone phone) {
|
||||
value = phone.getValue();
|
||||
type = phone.getType();
|
||||
label = Util.getStringIfNotBlank(phone.getLabel());
|
||||
static JsonContactPhone from(SharedContact.Phone phone) {
|
||||
return new JsonContactPhone(phone.getValue(), phone.getType(), Util.getStringIfNotBlank(phone.getLabel()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue