org.apache.james.mailbox
Class MessageRange

java.lang.Object
  extended by org.apache.james.mailbox.MessageRange

public class MessageRange
extends java.lang.Object

Used to define a range of messages by uid or msn, or a individual message by key or message object.
The type of the set should be defined by using an appropriate constructor.


Nested Class Summary
static class MessageRange.Type
           
 
Method Summary
static MessageRange all()
          Constructs a range consisting of all messages.
static MessageRange from(long from)
          Constructs an inclusive, open ended range of messages.
 MessageRange.Type getType()
           
 long getUidFrom()
           
 long getUidTo()
           
 boolean includes(long uid)
          Return true if the uid is within the range
static MessageRange one(long uid)
          Constructs a range consisting of a single message only.
static MessageRange range(long from, long to)
          Constructs an inclusive ranges of messages.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

one

public static MessageRange one(long uid)
Constructs a range consisting of a single message only.

Parameters:
uid - UID of the message
Returns:
not null

all

public static MessageRange all()
Constructs a range consisting of all messages.

Returns:
not null

range

public static MessageRange range(long from,
                                 long to)
Constructs an inclusive ranges of messages. The parameters will be checked and from(long) used where appropriate.

Parameters:
from - first message UID
to - last message UID
Returns:
not null

from

public static MessageRange from(long from)
Constructs an inclusive, open ended range of messages.

Parameters:
from - first messege UID in range
Returns:
not null

getType

public MessageRange.Type getType()

getUidFrom

public long getUidFrom()

getUidTo

public long getUidTo()

includes

public boolean includes(long uid)
Return true if the uid is within the range

Parameters:
uid -
Returns:
withinRange

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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