1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Cleanup texts and comments

This commit is contained in:
Lars Noschinski 2014-03-05 08:11:52 +01:00 committed by Florian Schmaus
parent 86a4bfa43f
commit 4cb799228c
7 changed files with 22 additions and 24 deletions

View file

@ -51,11 +51,11 @@ public class AndFilter implements PacketFilter {
*/ */
public AndFilter(PacketFilter... filters) { public AndFilter(PacketFilter... filters) {
if (filters == null) { if (filters == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
for(PacketFilter filter : filters) { for(PacketFilter filter : filters) {
if(filter == null) { if(filter == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
} }
this.filters = new ArrayList<PacketFilter>(Arrays.asList(filters)); this.filters = new ArrayList<PacketFilter>(Arrays.asList(filters));
@ -69,7 +69,7 @@ public class AndFilter implements PacketFilter {
*/ */
public void addFilter(PacketFilter filter) { public void addFilter(PacketFilter filter) {
if (filter == null) { if (filter == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
filters.add(filter); filters.add(filter);
} }

View file

@ -36,7 +36,7 @@ public class NotFilter implements PacketFilter {
*/ */
public NotFilter(PacketFilter filter) { public NotFilter(PacketFilter filter) {
if (filter == null) { if (filter == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
this.filter = filter; this.filter = filter;
} }

View file

@ -51,11 +51,11 @@ public class OrFilter implements PacketFilter {
*/ */
public OrFilter(PacketFilter... filters) { public OrFilter(PacketFilter... filters) {
if (filters == null) { if (filters == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
for(PacketFilter filter : filters) { for(PacketFilter filter : filters) {
if(filter == null) { if(filter == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
} }
this.filters = new ArrayList<PacketFilter>(Arrays.asList(filters)); this.filters = new ArrayList<PacketFilter>(Arrays.asList(filters));
@ -69,7 +69,7 @@ public class OrFilter implements PacketFilter {
*/ */
public void addFilter(PacketFilter filter) { public void addFilter(PacketFilter filter) {
if (filter == null) { if (filter == null) {
throw new IllegalArgumentException("Parameter cannot be null."); throw new IllegalArgumentException("Parameter must not be null.");
} }
filters.add(filter); filters.add(filter);
} }

View file

@ -20,24 +20,22 @@ package org.jivesoftware.smack.filter;
import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smack.packet.Packet;
/** /**
* Defines a way to filter packets for particular attributes. Packet filters are * Defines a way to filter packets for particular attributes. Packet filters are used when
* used when constructing packet listeners or collectors -- the filter defines * constructing packet listeners or collectors -- the filter defines what packets match the criteria
* what packets match the criteria of the collector or listener for further * of the collector or listener for further packet processing.
* packet processing.<p> * <p>
* * Several simple filters are pre-defined. These filters can be logically combined for more complex
* Several pre-defined filters are defined. These filters can be logically combined * packet filtering by using the {@link org.jivesoftware.smack.filter.AndFilter AndFilter} and
* for more complex packet filtering by using the * {@link org.jivesoftware.smack.filter.OrFilter OrFilter} filters. It's also possible to define
* {@link org.jivesoftware.smack.filter.AndFilter AndFilter} and * your own filters by implementing this interface. The code example below creates a trivial filter
* {@link org.jivesoftware.smack.filter.OrFilter OrFilter} filters. It's also possible * for packets with a specific ID (real code should use {@link PacketIDFilter} instead).
* to define your own filters by implementing this interface. The code example below
* creates a trivial filter for packets with a specific ID.
* *
* <pre> * <pre>
* // Use an anonymous inner class to define a packet filter that returns * // Use an anonymous inner class to define a packet filter that returns
* // all packets that have a packet ID of "RS145". * // all packets that have a packet ID of &quot;RS145&quot;.
* PacketFilter myFilter = new PacketFilter() { * PacketFilter myFilter = new PacketFilter() {
* public boolean accept(Packet packet) { * public boolean accept(Packet packet) {
* return "RS145".equals(packet.getPacketID()); * return &quot;RS145&quot;.equals(packet.getPacketID());
* } * }
* }; * };
* // Create a new packet collector using the filter we created. * // Create a new packet collector using the filter we created.

View file

@ -35,7 +35,7 @@ public class PacketIDFilter implements PacketFilter {
*/ */
public PacketIDFilter(String packetID) { public PacketIDFilter(String packetID) {
if (packetID == null) { if (packetID == null) {
throw new IllegalArgumentException("Packet ID cannot be null."); throw new IllegalArgumentException("Packet ID must not be null.");
} }
this.packetID = packetID; this.packetID = packetID;
} }

View file

@ -36,7 +36,7 @@ public class ThreadFilter implements PacketFilter {
*/ */
public ThreadFilter(String thread) { public ThreadFilter(String thread) {
if (thread == null) { if (thread == null) {
throw new IllegalArgumentException("Thread cannot be null."); throw new IllegalArgumentException("Thread must not be null.");
} }
this.thread = thread; this.thread = thread;
} }

View file

@ -235,8 +235,8 @@ public abstract class Packet {
/** /**
* Returns the first packet extension that matches the specified element name and * Returns the first packet extension that matches the specified element name and
* namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null * namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
* than only the provided namespace is attempted to be matched. Packet extensions are * only the namespace is matched. Packet extensions are
* are arbitrary XML sub-documents in standard XMPP packets. By default, a * are arbitrary XML sub-documents in standard XMPP packets. By default, a
* DefaultPacketExtension instance will be returned for each extension. However, * DefaultPacketExtension instance will be returned for each extension. However,
* PacketExtensionProvider instances can be registered with the * PacketExtensionProvider instances can be registered with the