org.apache.james.mailboxmanager.manager
Class MailboxExpression

java.lang.Object
  extended by org.apache.james.mailboxmanager.manager.MailboxExpression

public class MailboxExpression
extends java.lang.Object

Expresses select criteria for mailboxes.


Constructor Summary
MailboxExpression(java.lang.String base, java.lang.String expression, char freeWildcard, char localWildcard)
          Constructs an expression determining a set of mailbox names.
 
Method Summary
 java.lang.String getBase()
          Gets the base reference name for the search.
 java.lang.String getCombinedName(char hierarchyDelimiter)
          Get combined name formed by adding expression to base using the given hierarchy delimiter.
 java.lang.String getExpression()
          Gets the name search expression.
 char getFreeWildcard()
          Gets wildcard character that matches any series of characters.
 char getLocalWildcard()
          Gets wildacard character that matches any series of characters excluding hierarchy delimiters.
 boolean isExpressionMatch(java.lang.String name, char hierarchyDelimiter)
          Is the given name a match for getExpression()?
 boolean isWild()
          Is this expression wild?
 java.lang.String toString()
          Renders a string sutable for logging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MailboxExpression

public MailboxExpression(java.lang.String base,
                         java.lang.String expression,
                         char freeWildcard,
                         char localWildcard)
Constructs an expression determining a set of mailbox names.

Parameters:
base - base reference name, not null
expression - mailbox match expression, not null
freeWildcard - matches any series of charaters
localWildcard - matches any sequence of characters up to the next hierarchy delimiter
Method Detail

getBase

public final java.lang.String getBase()
Gets the base reference name for the search.

Returns:
the base

getExpression

public final java.lang.String getExpression()
Gets the name search expression. This may contain wildcards.

Returns:
the expression

getFreeWildcard

public final char getFreeWildcard()
Gets wildcard character that matches any series of characters.

Returns:
the freeWildcard

getLocalWildcard

public final char getLocalWildcard()
Gets wildacard character that matches any series of characters excluding hierarchy delimiters. Effectively, this means that it matches any sequence within a name part.

Returns:
the localWildcard

isExpressionMatch

public final boolean isExpressionMatch(java.lang.String name,
                                       char hierarchyDelimiter)
Is the given name a match for getExpression()?

Parameters:
name - name to be matched
hierarchyDelimiter - mailbox hierarchy delimiter
Returns:
true if the given name matches this expression, false otherwise

getCombinedName

public java.lang.String getCombinedName(char hierarchyDelimiter)
Get combined name formed by adding expression to base using the given hierarchy delimiter. Note that the wildcards are retained in the combined name.

Parameters:
hierarchyDelimiter - delimiter for mailbox hierarchy
Returns:
getBase() combined with getExpression(), not null

isWild

public boolean isWild()
Is this expression wild?

Returns:
true if wildcard contained, false otherwise

toString

public java.lang.String toString()
Renders a string sutable for logging.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this object.


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.