1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

Make Nick immutable

This commit is contained in:
Florian Schmaus 2018-10-21 09:01:54 +02:00
parent 2f1f0b6c1a
commit 382057f520

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.xmlpull.v1.XmlPullParser;
@ -37,10 +38,10 @@ public class Nick implements ExtensionElement {
public static final String ELEMENT_NAME = "nick";
private String name = null;
private final String name;
public Nick(String name) {
this.name = name;
this.name = StringUtils.requireNotNullNorEmpty(name, "Nickname must be given");
}
/**
@ -52,16 +53,6 @@ public class Nick implements ExtensionElement {
return name;
}
/**
* Sets the value of this nickname.
*
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
@Override
public String getElementName() {
return ELEMENT_NAME;