|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.mailet.GenericMatcher org.apache.james.transport.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 java.lang.String |
getAttributeName()
Returns the attributeName. |
protected java.lang.String |
getAttributeValue()
Returns the attributeValue. |
java.lang.String |
getMatcherInfo()
Return a string describing this matcher. |
void |
init(MatcherConfig config)
Called by the matcher container to indicate to a matcher that the matcher is being placed into service. |
java.util.Collection |
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(java.lang.String attributeName)
Sets the attributeName. |
protected void |
setAttributeValue(java.lang.String attributeValue)
Sets the attributeValue. |
Methods inherited from class org.apache.mailet.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 java.util.Collection 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
- - the Mail object that contains the MimeMessage and
routing information
MessagingException
- - if an message or address parsing exception occurs or
an exception that interferes with the matcher's normal operationMatcher.match(Mail)
protected java.lang.String getAttributeName()
protected java.lang.String getAttributeValue()
protected void setAttributeName(java.lang.String attributeName)
attributeName
- The attributeName to setprotected void setAttributeValue(java.lang.String attributeValue)
attributeValue
- The attributeValue to setpublic void init(MatcherConfig config) throws javax.mail.MessagingException
GenericMatcher
Called by the matcher container to indicate to a matcher that the matcher is being placed into service.
This implementation stores the MatcherConfig object it receives from the matcher container for alter use. When overriding this form of the method, call super.init(config).
init
in interface Matcher
init
in class GenericMatcher
config
- - a MatcherConfig object containing the matcher's configuration
and initialization parameters
javax.mail.MessagingException
- if an exception occurs that interrupts the matcher's normal operationMatcher.init(MatcherConfig)
public java.lang.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 |