|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mailet.base.GenericMatcher org.apache.james.mailet.standard.matchers.HasMailAttributeWithValue
public class HasMailAttributeWithValue
This Matcher determines if the mail contains the attribute specified in the condition and if the value answered when the method toString() is invoked on the attribute is equal to the String value specified in the condition. If both tests are true, all recipients are returned, else null.
Notes:
The current matcher implementation expects a single String value to match on. This matcher requires two values, the attribute name and attribute value. This requires some implicit rules to govern how the single value supplied to the matcher is parsed into two values.
Sample configuration:
<mailet match="HasMailAttributeWithValue=name, value" class="<any-class>">
Constructor Summary | |
---|---|
HasMailAttributeWithValue()
|
Method Summary | |
---|---|
protected String |
getAttributeName()
Returns the attributeName. |
protected String |
getAttributeValue()
Returns the attributeValue. |
String |
getMatcherInfo()
Return a string describing this matcher. |
void |
init()
A convenience method which can be overridden so that there's no need to call super.init(config). |
Collection<MailAddress> |
match(Mail mail)
Answers the recipients of the mail if the attribute is present, and has a toString() value equal to the configured value. |
protected void |
setAttributeName(String attributeName)
Sets the attributeName. |
protected void |
setAttributeValue(String attributeValue)
Sets the attributeValue. |
Methods inherited from class org.apache.mailet.base.GenericMatcher |
---|
destroy, getCondition, getMailetContext, getMatcherConfig, getMatcherName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HasMailAttributeWithValue()
Method Detail |
---|
public Collection<MailAddress> match(Mail mail) throws javax.mail.MessagingException
Answers the recipients of the mail if the attribute is present, and has a toString() value equal to the configured value.
match
in interface Matcher
match
in class GenericMatcher
mail
-
javax.mail.MessagingException
- if any error occurs which prevents the Mail
matching from completing successfullyprotected String getAttributeName()
protected String getAttributeValue()
protected void setAttributeName(String attributeName)
attributeName
- The attributeName to setprotected void setAttributeValue(String attributeValue)
attributeValue
- The attributeValue to setpublic void init() throws javax.mail.MessagingException
GenericMatcher
A convenience method which can be overridden so that there's no need to call super.init(config).
Instead of overriding init(MatcherConfig), simply override this method and it will be called by GenericMatcher.init(MatcherConfig config). The MatcherConfig object can still be retrieved via getMatcherConfig().
init
in class GenericMatcher
javax.mail.MessagingException
- if an exception occurs that interrupts the matcher's normal operationpublic String getMatcherInfo()
getMatcherInfo
in interface Matcher
getMatcherInfo
in class GenericMatcher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |