1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +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:
Florian Schmaus 2014-12-09 13:58:23 +01:00
parent 9e9241c0b9
commit 1c08d1c594

View file

@ -57,14 +57,15 @@ public class PacketExtensionFilter implements PacketFilter {
this(null, namespace);
}
/**
* Creates a new packet extension filter for the given packet extension.
*
* @param packetExtension
*/
public PacketExtensionFilter(PacketExtension packetExtension) {
this(packetExtension.getElementName(), packetExtension.getNamespace());
}
public PacketExtensionFilter(Class<? extends PacketExtension> packetExtensionClass) throws InstantiationException, IllegalAccessException {
this(packetExtensionClass.newInstance());
}
public boolean accept(Packet packet) {
return packet.hasExtension(elementName, namespace);
}