1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

[core] Add XmlStringBuilder.jidAttribute(Jid) and optJidAttribute(Jid)

This commit is contained in:
Florian Schmaus 2023-12-07 15:01:03 +01:00
parent b7218e3a72
commit 726dbc0d27

View file

@ -28,6 +28,7 @@ import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jxmpp.jid.Jid;
import org.jxmpp.util.XmppDateTime;
public class XmlStringBuilder implements Appendable, CharSequence, Element {
@ -311,6 +312,18 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
return attribute(name, String.valueOf(value));
}
public XmlStringBuilder jidAttribute(Jid jid) {
assert jid != null;
return attribute("jid", jid);
}
public XmlStringBuilder optJidAttribute(Jid jid) {
if (jid != null) {
attribute("jid", jid);
}
return this;
}
public XmlStringBuilder optAttribute(String name, String value) {
if (value != null) {
attribute(name, value);