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