1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-10-18 12:15:58 +02:00

[core] Add NotFilter.of(Class<E extends ExtensionElement>)

This commit is contained in:
Florian Schmaus 2024-06-22 20:01:19 +02:00
parent 5cbcd67645
commit 0bb3bf292c

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2003-2007 Jive Software. * Copyright 2003-2007 Jive Software, 2024 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,6 +17,7 @@
package org.jivesoftware.smack.filter; package org.jivesoftware.smack.filter;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smack.util.Objects;
@ -43,4 +44,9 @@ public class NotFilter implements StanzaFilter {
public boolean accept(Stanza packet) { public boolean accept(Stanza packet) {
return !filter.accept(packet); return !filter.accept(packet);
} }
public static <E extends ExtensionElement> NotFilter of(Class<E> extensionElementClass) {
ExtensionElementFilter<E> extensionElementFilter = new ExtensionElementFilter<>(extensionElementClass);
return new NotFilter(extensionElementFilter);
}
} }