mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-29 09:42:06 +01:00
Remove PacketExtensionFilter(Class) constructor
as it's potential error prone, because most PacketExtension's don't have a non-argument constructor required for this to work. Also add some javadoc.
This commit is contained in:
parent
9e9241c0b9
commit
1c08d1c594
1 changed files with 5 additions and 4 deletions
|
@ -57,14 +57,15 @@ public class PacketExtensionFilter implements PacketFilter {
|
||||||
this(null, namespace);
|
this(null, namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new packet extension filter for the given packet extension.
|
||||||
|
*
|
||||||
|
* @param packetExtension
|
||||||
|
*/
|
||||||
public PacketExtensionFilter(PacketExtension packetExtension) {
|
public PacketExtensionFilter(PacketExtension packetExtension) {
|
||||||
this(packetExtension.getElementName(), packetExtension.getNamespace());
|
this(packetExtension.getElementName(), packetExtension.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PacketExtensionFilter(Class<? extends PacketExtension> packetExtensionClass) throws InstantiationException, IllegalAccessException {
|
|
||||||
this(packetExtensionClass.newInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Packet packet) {
|
||||||
return packet.hasExtension(elementName, namespace);
|
return packet.hasExtension(elementName, namespace);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue