1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-28 23:27:57 +01:00

core: re-add Stanza.getExtension(String, String) and mark deprecated

This method was removed with 07da9ffb4 ("Do not have
Stanza.getExtension(String, String) return a generic type"). In order
to aide migration to the newer API, this commit re-adds the method and
marks it as deprecated.
This commit is contained in:
Florian Schmaus 2020-04-12 12:13:32 +02:00
parent 7bc2ebb731
commit d498cd8499

View file

@ -369,6 +369,22 @@ public abstract class Stanza implements StanzaView, TopLevelStreamElement {
return packetExtension;
}
/**
* This method is deprecated. Use preferably {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)}.
*
* @param <E> the type to cast to.
* @param elementName the XML element name of the extension. (May be null)
* @param namespace the XML element namespace of the extension.
* @return the extension, or <code>null</code> if it doesn't exist.
* @deprecated use {@link #getExtension(Class)} or {@link #getExtensionElement(String, String)} isntead.
*/
// TODO: Remove in Smack 4.5.
@SuppressWarnings("unchecked")
@Deprecated
public final <E extends ExtensionElement> E getExtension(String elementName, String namespace) {
return (E) getExtensionElement(elementName, namespace);
}
@Override
public final ExtensionElement getExtension(QName qname) {
synchronized (extensionElements) {