This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/src/main/java/envoy/event/MessageStatusChangeEvent.java

63 lines
1.7 KiB
Java
Raw Normal View History

package envoy.event;
import java.util.Date;
import envoy.data.Message;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>MessageStatusChangeEvent.java</strong><br>
* Created: <strong>6 Jan 2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/
public class MessageStatusChangeEvent implements Event<Message.MessageStatus> {
private final long id;
private final Message.MessageStatus status;
private final Date date;
/**
* Initializes a {@link MessageStatusChangeEvent}.
*
* @param id the ID of the {@link Message} this event is related to
* @param status the status of the {@link Message} this event is related
* to
* @param date the date at which the MessageStatus change occurred
* @since Envoy Common v0.2-alpha
*/
public MessageStatusChangeEvent(long id, Message.MessageStatus status, Date date) {
this.id = id;
this.status = status;
this.date = date;
}
/**
* Initialises a {@link MessageStatusChangeEvent} through a message.
*
* @param message the message from which to build the event
* @since Envoy Common v0.2-alpha
*/
public MessageStatusChangeEvent(Message message) { this(message.getId(), message.getStatus(), new Date()); }
/**
* @return the status of the {@link Message} this event is related to
* @since Envoy Common v0.2-alpha
*/
@Override
public Message.MessageStatus get() { return status; }
/**
* @return the ID of the {@link Message} this event is related to
* @since Envoy Common v0.2-alpha
*/
public long getId() { return id; }
/**
* @return the date at which the status change occurred
* @since Envoy Common v0.2-alpha
*/
public Date getDate() { return date; }
}