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.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); }
|
||||||
|
|
||||||
|
@ -33,6 +33,14 @@ public class MessageStatusChangeEvent implements Event<Message.MessageStatus> {
|
|||||||
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