mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-24 23:32:05 +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:
parent
7bc2ebb731
commit
d498cd8499
1 changed files with 16 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue