1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 10:19:41 +02:00

Rework XML Element hierarchy and XmlStringBuilder

- Reduce the amount of types that are subtypes of NamedElement. See
javadoc of NamedElement for rationale.
- Work more with XmlEnvironment in XmlStringBuilder.
- Some minor changes to XmlStringBuilder API.
This commit is contained in:
Florian Schmaus 2019-09-07 18:17:08 +02:00
parent e9bcdf3e6d
commit 65576cf3c2
74 changed files with 653 additions and 523 deletions

View file

@ -24,8 +24,8 @@ import java.util.Locale;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.NamedElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.EqualsUtil;
import org.jivesoftware.smack.util.HashCode;
@ -112,7 +112,7 @@ public final class RosterPacket extends IQ {
* the groups the roster item belongs to.
*/
// TODO Make this class immutable.
public static final class Item implements NamedElement {
public static final class Item implements ExtensionElement {
/**
* The constant value "{@value}".
@ -163,6 +163,11 @@ public final class RosterPacket extends IQ {
return ELEMENT;
}
@Override
public String getNamespace() {
return NAMESPACE;
}
/**
* Returns the user.
*
@ -275,7 +280,7 @@ public final class RosterPacket extends IQ {
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
XmlStringBuilder xml = new XmlStringBuilder(this);
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
xml.attribute("jid", jid);
xml.optAttribute("name", name);
xml.optAttribute("subscription", itemType);