mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
[core] Add NotFilter.of(Class<E extends ExtensionElement>)
This commit is contained in:
parent
5cbcd67645
commit
0bb3bf292c
1 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue