Package org.jivesoftware.smack.filter
Class FromMatchesFilter
- java.lang.Object
-
- org.jivesoftware.smack.filter.AbstractFromToMatchesFilter
-
- org.jivesoftware.smack.filter.FromMatchesFilter
-
- All Implemented Interfaces:
StanzaFilter
,Predicate<Stanza>
public final class FromMatchesFilter extends AbstractFromToMatchesFilter
Filter for packets where the "from" field exactly matches a specified JID. If the specified address is a bare JID then the filter will match any address whose bare JID matches the specified JID. But if the specified address is a full JID then the filter will only match if the sender of the stanza matches the specified resource.
-
-
Field Summary
Fields Modifier and Type Field Description static FromMatchesFilter
MATCH_NO_FROM_SET
-
Constructor Summary
Constructors Constructor Description FromMatchesFilter(Jid address, boolean ignoreResourcepart)
Creates a filter matching on the "from" field.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FromMatchesFilter
create(Jid address)
Creates a filter matching on the "from" field.static FromMatchesFilter
createBare(Jid address)
Creates a filter matching on the "from" field.static FromMatchesFilter
createFull(Jid address)
Creates a filter matching on the "from" field.protected Jid
getAddressToCompare(Stanza stanza)
-
Methods inherited from class org.jivesoftware.smack.filter.AbstractFromToMatchesFilter
accept, 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
-
MATCH_NO_FROM_SET
public static final FromMatchesFilter MATCH_NO_FROM_SET
-
-
Constructor Detail
-
FromMatchesFilter
public FromMatchesFilter(Jid address, boolean ignoreResourcepart)
Creates a filter matching on the "from" field. The from address must be the same as the filter address. The second parameter specifies whether the full or the bare addresses are compared.- Parameters:
address
- The address to filter for. Ifnull
is given, the stanza must not have a from address.ignoreResourcepart
- TODO javadoc me please
-
-
Method Detail
-
create
public static FromMatchesFilter create(Jid address)
Creates a filter matching on the "from" field. If the filter address is bare, compares the filter address with the bare from address. Otherwise, compares the filter address with the full from address.- Parameters:
address
- The address to filter for. Ifnull
is given, the stanza must not have a from address.- Returns:
- filter for the "from" address.
-
createBare
public static FromMatchesFilter createBare(Jid address)
Creates a filter matching on the "from" field. Compares the bare version of from and filter address.- Parameters:
address
- The address to filter for. Ifnull
is given, the stanza must not have a from address.- Returns:
- filter matching the "from" address.
-
createFull
public static FromMatchesFilter createFull(Jid address)
Creates a filter matching on the "from" field. Compares the full version, if available, of from and filter address.- Parameters:
address
- The address to filter for. Ifnull
is given, the stanza must not have a from address.- Returns:
- filter matching the "from" address.
-
getAddressToCompare
protected Jid getAddressToCompare(Stanza stanza)
- Specified by:
getAddressToCompare
in classAbstractFromToMatchesFilter
-
-