SK.gnome.dwarf.mail.store.search
Class HeaderKey

java.lang.Object
  extended bySK.gnome.dwarf.mail.store.search.SearchKey
      extended bySK.gnome.dwarf.mail.store.search.HeaderKey

public class HeaderKey
extends SearchKey

This key matches the given header and the actual message header value.


Field Summary
protected  java.lang.String name
          The matched header name.
static int PARTIAL
          This key type specifies that a partial word will be matched.
static int PRESENCE
          This key type specifies that the header will be always matched if it is present.
static int SUBSTRING
          This key type specifies that a substring will be matched.
protected  java.lang.String value
          The matched header value.
static int WORD
          This key type specifies that a single word will be matched.
 
Fields inherited from class SK.gnome.dwarf.mail.store.search.SearchKey
type
 
Constructor Summary
HeaderKey(int type, java.lang.String name, java.lang.String value)
          Creates a new HeaderKey with the given type, name and value.
HeaderKey(java.lang.String name)
          Creates a new HeaderKey with the given name.
HeaderKey(java.lang.String name, java.lang.String value)
          Creates a new HeaderKey with the given name and value.
 
Method Summary
 java.lang.String getName()
          Returns the matched header name.
 java.lang.String getValue()
          Returns the matched header value.
 boolean match(MailMessage message)
          Matches the given header and the actual message header.
 java.lang.String toString()
          Returns the string represenation of the key.
 
Methods inherited from class SK.gnome.dwarf.mail.store.search.SearchKey
addError, clearErrors, getErrors, getType, hasError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRESENCE

public static final int PRESENCE
This key type specifies that the header will be always matched if it is present.

See Also:
Constant Field Values

SUBSTRING

public static final int SUBSTRING
This key type specifies that a substring will be matched.

See Also:
Constant Field Values

WORD

public static final int WORD
This key type specifies that a single word will be matched.

See Also:
Constant Field Values

PARTIAL

public static final int PARTIAL
This key type specifies that a partial word will be matched.

See Also:
Constant Field Values

name

protected java.lang.String name
The matched header name.


value

protected java.lang.String value
The matched header value.

Constructor Detail

HeaderKey

public HeaderKey(java.lang.String name)
Creates a new HeaderKey with the given name.

The type of the key is set to PRESENCE.

Parameters:
name - the header name

HeaderKey

public HeaderKey(java.lang.String name,
                 java.lang.String value)
Creates a new HeaderKey with the given name and value.

The type of the key is set to SUBSTRING.

Parameters:
name - the header name
value - the header value

HeaderKey

public HeaderKey(int type,
                 java.lang.String name,
                 java.lang.String value)
Creates a new HeaderKey with the given type, name and value.

Parameters:
type - the key type
name - the header name
value - the header value
Method Detail

getName

public java.lang.String getName()
Returns the matched header name.

Returns:
the header name

getValue

public java.lang.String getValue()
Returns the matched header value.

Returns:
the header value

match

public boolean match(MailMessage message)
              throws MailException
Matches the given header and the actual message header.

Specified by:
match in class SearchKey
Parameters:
message - the searched message
Returns:
true if the given key criteria and message matches, false otherwise
Throws:
MailException - if an error occurs

toString

public java.lang.String toString()
Description copied from class: SearchKey
Returns the string represenation of the key.

Overrides:
toString in class SearchKey
Returns:
the key string


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.