com.openexchange.mail.search
Class BodyTerm

java.lang.Object
  extended by com.openexchange.mail.search.SearchTerm<java.lang.String>
      extended by com.openexchange.mail.search.BodyTerm
All Implemented Interfaces:
java.io.Serializable

public final class BodyTerm
extends SearchTerm<java.lang.String>

BodyTerm

Author:
Thorben Betten
See Also:
Serialized Form

Constructor Summary
BodyTerm(java.lang.String pattern)
          Initializes a new BodyTerm
 
Method Summary
 void addMailField(java.util.Collection<MailField> col)
          Adds the addressed MailField to specified collection
 boolean containsWildcard()
          Checks if this search term's pattern contains wildcard characters '*' and '?'
 javax.mail.search.SearchTerm getJavaMailSearchTerm()
          Generates the corresponding JavaMail instance of SearchTerm from this search term
 javax.mail.search.SearchTerm getNonWildcardJavaMailSearchTerm()
          Generates the corresponding instance of SearchTerm from this search term without any wildcard characters.
 java.lang.String getPattern()
          Gets the pattern to which the expression should match.
 boolean isAscii()
          Checks if this search term's pattern only consists of ASCII 7 bit characters.
 boolean matches(MailMessage mailMessage)
          Checks if specified mail message matches this search term
 boolean matches(javax.mail.Message msg)
          Checks if given message matches this search term
 
Methods inherited from class com.openexchange.mail.search.SearchTerm
filter, filter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BodyTerm

public BodyTerm(java.lang.String pattern)
Initializes a new BodyTerm

Method Detail

getPattern

public java.lang.String getPattern()
Description copied from class: SearchTerm
Gets the pattern to which the expression should match.

Specified by:
getPattern in class SearchTerm<java.lang.String>
Returns:
The pattern

addMailField

public void addMailField(java.util.Collection<MailField> col)
Description copied from class: SearchTerm
Adds the addressed MailField to specified collection

Specified by:
addMailField in class SearchTerm<java.lang.String>
Parameters:
col - The collection which gathers addressed fields

matches

public boolean matches(MailMessage mailMessage)
                throws MailException
Description copied from class: SearchTerm
Checks if specified mail message matches this search term

Specified by:
matches in class SearchTerm<java.lang.String>
Parameters:
mailMessage - The mail message to check
Returns:
true if specified mail message matches this search term; otherwise false
Throws:
MailException - If checking mail message against search term fails

matches

public boolean matches(javax.mail.Message msg)
                throws MailException
Description copied from class: SearchTerm
Checks if given message matches this search term

Specified by:
matches in class SearchTerm<java.lang.String>
Parameters:
msg - The message to check
Returns:
true if message matches this search term; otherwise false
Throws:
MailException - If check fails

getJavaMailSearchTerm

public javax.mail.search.SearchTerm getJavaMailSearchTerm()
Description copied from class: SearchTerm
Generates the corresponding JavaMail instance of SearchTerm from this search term

Specified by:
getJavaMailSearchTerm in class SearchTerm<java.lang.String>
Returns:
The corresponding instance of SearchTerm

getNonWildcardJavaMailSearchTerm

public javax.mail.search.SearchTerm getNonWildcardJavaMailSearchTerm()
Description copied from class: SearchTerm
Generates the corresponding instance of SearchTerm from this search term without any wildcard characters.

This is useful to preselect possible positives and to manually filtering out false positives.

Specified by:
getNonWildcardJavaMailSearchTerm in class SearchTerm<java.lang.String>
Returns:
The corresponding instance of SearchTerm without any wildcard characters.
See Also:
SearchTerm.containsWildcard()

isAscii

public boolean isAscii()
Description copied from class: SearchTerm
Checks if this search term's pattern only consists of ASCII 7 bit characters.

This method implies that this search is some kind of string search term. Returns true if not appropriate.

Overrides:
isAscii in class SearchTerm<java.lang.String>
Returns:
true if search term's pattern only consists of ASCII 7 bit characters; otherwise false

containsWildcard

public boolean containsWildcard()
Description copied from class: SearchTerm
Checks if this search term's pattern contains wildcard characters '*' and '?'.

This method implies that this search is some kind of string search term. Returns false if not appropriate.

Overrides:
containsWildcard in class SearchTerm<java.lang.String>
Returns:
true if this search term's pattern contains wildcard characters; otherwise false