org.whispersystems.signalservice.api.messages.SignalServiceContent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java
/*
* Copyright (C) 2014-2016 Open Whisper Systems
*
* Licensed according to the LICENSE file in this repository.
*/
package org.whispersystems.signalservice.api.messages;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
public class SignalServiceContent {
private final Optional message;
private final Optional synchronizeMessage;
private final Optional callMessage;
private final Optional readMessage;
public SignalServiceContent() {
this.message = Optional.absent();
this.synchronizeMessage = Optional.absent();
this.callMessage = Optional.absent();
this.readMessage = Optional.absent();
}
public SignalServiceContent(SignalServiceDataMessage message) {
this.message = Optional.fromNullable(message);
this.synchronizeMessage = Optional.absent();
this.callMessage = Optional.absent();
this.readMessage = Optional.absent();
}
public SignalServiceContent(SignalServiceSyncMessage synchronizeMessage) {
this.message = Optional.absent();
this.synchronizeMessage = Optional.fromNullable(synchronizeMessage);
this.callMessage = Optional.absent();
this.readMessage = Optional.absent();
}
public SignalServiceContent(SignalServiceCallMessage callMessage) {
this.message = Optional.absent();
this.synchronizeMessage = Optional.absent();
this.callMessage = Optional.of(callMessage);
this.readMessage = Optional.absent();
}
public SignalServiceContent(SignalServiceReceiptMessage receiptMessage) {
this.message = Optional.absent();
this.synchronizeMessage = Optional.absent();
this.callMessage = Optional.absent();
this.readMessage = Optional.of(receiptMessage);
}
public Optional getDataMessage() {
return message;
}
public Optional getSyncMessage() {
return synchronizeMessage;
}
public Optional getCallMessage() {
return callMessage;
}
public Optional getReceiptMessage() {
return readMessage;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy