package envoy.event; import envoy.data.Contact; /** * This event informs *

* a) the server of the name change of a user or a group. b) another user of this users name change. * * @author Leon Hofmeister * @since Envoy Common v0.1-beta */ public final class NameChange extends Event { private final long id; private static final long serialVersionUID = 0L; /** * Creates a new {@link NameChange} for a user or a group. * * @param contactID the id of the {@link Contact} who wishes to change his name * @param newName the new name of this contact * @since Envoy Common v0.1-beta */ public NameChange(long contactID, String newName) { super(newName); id = contactID; } /** * Initializes a {@link NameChange} through a Contact where the name has already been set. * * @param contact the contact whose name was updated * @since Envoy Common v0.2-alpha */ public NameChange(Contact contact) { this(contact.getID(), contact.getName()); } /** * @return the ID of the {@link Contact} this event is related to * @since Envoy Common v0.2-alpha */ public long getID() { return id; } @Override public String toString() { return String.format("NameChange[id=%d,name=%s]", id, value); } }