001/**
002 *
003 * Copyright 2018 Paul Schaub
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.omemo.util;
018
019import org.jivesoftware.smack.packet.Message;
020import org.jivesoftware.smack.util.Objects;
021
022import org.jivesoftware.smackx.omemo.OmemoMessage;
023
024public class MessageOrOmemoMessage {
025
026    private final Message message;
027    private final OmemoMessage.Received omemoMessage;
028
029    public MessageOrOmemoMessage(Message message) {
030        this.message = Objects.requireNonNull(message);
031        this.omemoMessage = null;
032    }
033
034    public MessageOrOmemoMessage(OmemoMessage.Received omemoMessage) {
035        this.omemoMessage = Objects.requireNonNull(omemoMessage);
036        this.message = null;
037    }
038
039    public boolean isOmemoMessage() {
040        return omemoMessage != null;
041    }
042
043    public Message getMessage() {
044        return message;
045    }
046
047    public OmemoMessage.Received getOmemoMessage() {
048        return omemoMessage;
049    }
050}