001/** 002 * 003 * Copyright 2003-2007 Jive Software. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.jivesoftware.smack.filter; 019 020/** 021 * Defines a way to filter packets for particular attributes. Stanza filters are used when 022 * constructing stanza listeners or collectors -- the filter defines what packets match the criteria 023 * of the collector or listener for further stanza processing. 024 * <p> 025 * Several simple filters are pre-defined. These filters can be logically combined for more complex 026 * stanza filtering by using the {@link org.jivesoftware.smack.filter.AndFilter AndFilter} and 027 * {@link org.jivesoftware.smack.filter.OrFilter OrFilter} filters. It's also possible to define 028 * your own filters by implementing this interface. The code example below creates a trivial filter 029 * for packets with a specific ID (real code should use {@link StanzaIdFilter} instead). 030 * 031 * <pre> 032 * // Use an anonymous inner class to define a stanza filter that returns 033 * // all packets that have a stanza ID of "RS145". 034 * PacketFilter myFilter = new PacketFilter() { 035 * public boolean accept(Packet packet) { 036 * return "RS145".equals(packet.getStanzaId()); 037 * } 038 * }; 039 * // Create a new stanza collector using the filter we created. 040 * StanzaCollector myCollector = packetReader.createStanzaCollector(myFilter); 041 * </pre> 042 * 043 * @see org.jivesoftware.smack.StanzaCollector 044 * @see org.jivesoftware.smack.StanzaListener 045 * @author Matt Tucker 046 * @deprecated use {@link StanzaFilter} 047 */ 048@Deprecated 049public interface PacketFilter extends StanzaFilter { 050 051}