mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02:00
Make ExtensionElement marker interface wrt. QNAME field
ExtensionElement is now a marker interface that requires all implementation non-abstract classes to carry a static final QNAME field (of type QName). This is verified by a new unit test. Also FullyQualifiedElement is renamed to simply XmlElement. XmlElement is used over ExtensionElement when implementing classes do not statically know the qualified name of the XML elements they represent. In general, XmlElement should be used sparingly, and every XML element should be modeled by its own Java class (implementing ExtensionElement).
This commit is contained in:
parent
5493a22e44
commit
3d4e7938a7
146 changed files with 600 additions and 344 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014-2018 Florian Schmaus
|
||||
* Copyright © 2014-2021 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -19,6 +19,8 @@ package org.jivesoftware.smack.sm.packet;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.Nonza;
|
||||
import org.jivesoftware.smack.packet.StanzaError;
|
||||
|
@ -31,6 +33,8 @@ public class StreamManagement {
|
|||
public static final class StreamManagementFeature implements ExtensionElement {
|
||||
|
||||
public static final String ELEMENT = "sm";
|
||||
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||
|
||||
public static final StreamManagementFeature INSTANCE = new StreamManagementFeature();
|
||||
|
||||
private StreamManagementFeature() {
|
||||
|
@ -38,12 +42,12 @@ public class StreamManagement {
|
|||
|
||||
@Override
|
||||
public String getElementName() {
|
||||
return ELEMENT;
|
||||
return QNAME.getLocalPart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
return NAMESPACE;
|
||||
return QNAME.getNamespaceURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue