Class StanzaTypeFilter

java.lang.Object
org.jivesoftware.smack.filter.StanzaTypeFilter
All Implemented Interfaces:
Predicate<Stanza>, StanzaFilter

public final class StanzaTypeFilter extends 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 Details

  • Constructor Details

    • StanzaTypeFilter

      public StanzaTypeFilter(Class<? extends Stanza> packetType)
      Creates a new stanza type filter that will filter for packets that are the same type as packetType.
      Parameters:
      packetType - the Class type.
  • Method Details

    • 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 interface StanzaFilter
      Parameters:
      packet - the stanza to test.
      Returns:
      true if and only if stanza passes the filter.
    • toString

      public String toString()
      Overrides:
      toString in class Object