mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 05:51:08 +01:00
Do not have Stanza.getExtension(String, String) return a generic type
Returning a generic would allow for
List<ExtensionElement> list = stanza.getExtension("foo", "bar");
to compile (Note the we are calling getExtension(), not
getExtension*s*()).
Users are encouraged to use the type safe getExtension(Class<? extends
ExtensionElement) variant instead.
Fixes SMACK-825.
This commit is contained in:
parent
62916b8490
commit
07da9ffb48
65 changed files with 207 additions and 121 deletions
|
|
@ -19,6 +19,8 @@ package org.jivesoftware.smackx.shim.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.Stanza;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
|
@ -33,6 +35,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
public class HeadersExtension implements ExtensionElement {
|
||||
public static final String ELEMENT = "headers";
|
||||
public static final String NAMESPACE = "http://jabber.org/protocol/shim";
|
||||
public static final QName QNAME = new QName(NAMESPACE, ELEMENT);
|
||||
|
||||
private final List<Header> headers;
|
||||
|
||||
|
|
@ -74,6 +77,6 @@ public class HeadersExtension implements ExtensionElement {
|
|||
* @return the headers extension or null.
|
||||
*/
|
||||
public static HeadersExtension from(Stanza packet) {
|
||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||
return packet.getExtension(HeadersExtension.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue