FileDocCategorySizeDatePackage
GenericRecipientMatcher.javaAPI DocApache James 2.3.12817Fri Jan 12 12:56:34 GMT 2007org.apache.mailet

GenericRecipientMatcher

public abstract class GenericRecipientMatcher extends GenericMatcher
GenericMatcher makes writing recipient based matchers easier. It provides simple versions of the lifecycle methods init and destroy and of the methods in the MatcherConfig interface. GenericMatcher also implements the log method, declared in the MatcherContext interface.
version
1.0.0, 24/04/1999

Fields Summary
Constructors Summary
Methods Summary
public final java.util.Collectionmatch(Mail mail)
Matches each recipient one by one through matchRecipient(MailAddress recipient) method. Handles splitting the recipients Collection as appropriate.

param
mail - the message and routing information to determine whether to match
return
Collection the Collection of MailAddress objects that have been matched

        Collection matching = new Vector();
        for (Iterator i = mail.getRecipients().iterator(); i.hasNext(); ) {
            MailAddress rec = (MailAddress) i.next();
            if (matchRecipient(rec)) {
                matching.add(rec);
            }
        }
        return matching;
    
public abstract booleanmatchRecipient(MailAddress recipient)
Simple check to match exclusively on the email address (not message information).

param
recipient - the address to determine whether to match
return
boolean whether the recipient is a match