mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 18:29:45 +02:00
Improve DeliveryReceipt code, add javadoc
Also make Packet.getExtension() use Generics
This commit is contained in:
parent
c063fb1376
commit
bd0ada480b
5 changed files with 48 additions and 17 deletions
|
@ -240,7 +240,8 @@ public abstract class Packet {
|
|||
* @param namespace the XML element namespace of the packet extension.
|
||||
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
||||
*/
|
||||
public PacketExtension getExtension(String elementName, String namespace) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <PE extends PacketExtension> PE getExtension(String elementName, String namespace) {
|
||||
if (namespace == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -248,7 +249,7 @@ public abstract class Packet {
|
|||
if ((elementName == null || elementName.equals(ext.getElementName()))
|
||||
&& namespace.equals(ext.getNamespace()))
|
||||
{
|
||||
return ext;
|
||||
return (PE) ext;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue