1
0
Fork 0
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:
Florian Schmaus 2021-04-18 18:58:50 +02:00
parent 5493a22e44
commit 3d4e7938a7
146 changed files with 600 additions and 344 deletions

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.omemo.element;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.FullyQualifiedElement;
import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smack.util.stringencoder.Base64;
@ -30,7 +30,7 @@ import org.jivesoftware.smackx.omemo.util.OmemoConstants;
* Header element of the message. The header contains information about the sender and the encrypted keys for
* the recipients, as well as the iv element for AES.
*/
public abstract class OmemoHeaderElement implements FullyQualifiedElement {
public abstract class OmemoHeaderElement implements XmlElement {
public static final String ELEMENT = "header";
public static final String NAMESPACE = OmemoConstants.OMEMO_NAMESPACE_V_AXOLOTL;

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smackx.omemo.element;
import org.jivesoftware.smack.packet.FullyQualifiedElement;
import org.jivesoftware.smack.packet.XmlElement;
import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.util.XmlStringBuilder;
import org.jivesoftware.smack.util.stringencoder.Base64;
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.omemo.util.OmemoConstants;
/**
* Small class to collect key (byte[]), its id and whether its a preKey or not.
*/
public class OmemoKeyElement implements FullyQualifiedElement {
public class OmemoKeyElement implements XmlElement {
public static final String ELEMENT = "key";
public static final String NAMESPACE = OmemoConstants.OMEMO_NAMESPACE_V_AXOLOTL;