Added a constructor for User as well as for MessageStatusChangeEvent
This commit is contained in:
parent
3d0b67d6ba
commit
1a4523db54
@ -81,7 +81,6 @@ public class Message implements Serializable {
|
||||
this.text = text;
|
||||
this.attachment = attachment;
|
||||
this.status = status;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public class User implements Serializable {
|
||||
|
||||
/**
|
||||
* Initializes a {@link User}. The {@link UserStatus} is set to
|
||||
* {@link UserStatus#OFFLINE}.
|
||||
* {@link UserStatus#ONLINE}.
|
||||
*
|
||||
* @param id unique ID
|
||||
* @param name user name
|
||||
@ -65,6 +65,19 @@ public class User implements Serializable {
|
||||
status = UserStatus.ONLINE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a {@link User}.
|
||||
*
|
||||
* @param id unique ID
|
||||
* @param name user name
|
||||
* @param status the status of the user
|
||||
* @since Envoy Common v0.2-alpha
|
||||
*/
|
||||
public User(long id, String name, UserStatus status) {
|
||||
this(id, name);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() { return String.format("User[id=%d,name=%s,status=%s]", id, name, status); }
|
||||
|
||||
|
@ -23,16 +23,24 @@ public class MessageStatusChangeEvent implements Event<Message.MessageStatus> {
|
||||
*
|
||||
* @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
|
||||
* 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;
|
||||
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
|
||||
|
Reference in New Issue
Block a user