Package org.jivesoftware.smack.filter
Class StanzaTypeFilter
- java.lang.Object
-
- org.jivesoftware.smack.filter.StanzaTypeFilter
-
- All Implemented Interfaces:
StanzaFilter
,Predicate<Stanza>
public final class StanzaTypeFilter extends java.lang.Object implements StanzaFilter
Filters for Stanzas of a particular type. The type is given as a Class object, so example types would:Message.class
IQ.class
Presence.class
-
-
Field Summary
Fields Modifier and Type Field Description static StanzaTypeFilter
IQ
static StanzaTypeFilter
MESSAGE
static StanzaTypeFilter
PRESENCE
-
Constructor Summary
Constructors Constructor Description StanzaTypeFilter(java.lang.Class<? extends Stanza> packetType)
Creates a new stanza type filter that will filter for packets that are the same type aspacketType
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Stanza packet)
Tests whether or not the specified stanza should pass the filter.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.filter.StanzaFilter
asPredicate, test
-
-
-
-
Field Detail
-
PRESENCE
public static final StanzaTypeFilter PRESENCE
-
MESSAGE
public static final StanzaTypeFilter MESSAGE
-
IQ
public static final StanzaTypeFilter IQ
-
-
Constructor Detail
-
StanzaTypeFilter
public StanzaTypeFilter(java.lang.Class<? extends Stanza> packetType)
Creates a new stanza type filter that will filter for packets that are the same type aspacketType
.- Parameters:
packetType
- the Class type.
-
-
Method Detail
-
accept
public boolean accept(Stanza packet)
Description copied from interface:StanzaFilter
Tests whether or not the specified stanza should pass the filter.- Specified by:
accept
in interfaceStanzaFilter
- Parameters:
packet
- the stanza to test.- Returns:
- true if and only if
stanza
passes the filter.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-