Class SearchSequence


  • public class SearchSequence
    extends java.lang.Object
    This class traverses a search-tree and generates the corresponding IMAP search sequence. Each IMAPProtocol instance contains an instance of this class, which might be subclassed by subclasses of IMAPProtocol to add support for additional product-specific search terms.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Calendar cal  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Argument and​(jakarta.mail.search.AndTerm term, java.lang.String charset)  
      protected Argument body​(jakarta.mail.search.BodyTerm term, java.lang.String charset)  
      protected Argument flag​(jakarta.mail.search.FlagTerm term)  
      protected Argument from​(java.lang.String address, java.lang.String charset)  
      Argument generateSequence​(jakarta.mail.search.SearchTerm term, java.lang.String charset)
      Generate the IMAP search sequence for the given search expression.
      protected Argument header​(jakarta.mail.search.HeaderTerm term, java.lang.String charset)  
      static boolean isAscii​(jakarta.mail.search.SearchTerm term)
      Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.
      static boolean isAscii​(jakarta.mail.search.SearchTerm[] terms)
      Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.
      static boolean isAscii​(java.lang.String s)
      Does this string contain only ASCII characters?
      protected Argument messageid​(jakarta.mail.search.MessageIDTerm term, java.lang.String charset)  
      protected Argument modifiedSince​(ModifiedSinceTerm term)
      Generate argument for ModifiedSinceTerm.
      protected Argument not​(jakarta.mail.search.NotTerm term, java.lang.String charset)  
      protected Argument older​(OlderTerm term)
      Generate argument for OlderTerm.
      protected Argument or​(jakarta.mail.search.OrTerm term, java.lang.String charset)  
      protected Argument receiveddate​(jakarta.mail.search.DateTerm term)  
      protected Argument recipient​(jakarta.mail.Message.RecipientType type, java.lang.String address, java.lang.String charset)  
      protected Argument sentdate​(jakarta.mail.search.DateTerm term)  
      protected Argument size​(jakarta.mail.search.SizeTerm term)  
      protected Argument subject​(jakarta.mail.search.SubjectTerm term, java.lang.String charset)  
      protected java.lang.String toIMAPDate​(java.util.Date date)  
      protected Argument younger​(YoungerTerm term)
      Generate argument for YoungerTerm.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cal

        protected java.util.Calendar cal
    • Constructor Detail

      • SearchSequence

        public SearchSequence​(IMAPProtocol p)
        Create a SearchSequence for this IMAPProtocol.
        Parameters:
        p - the IMAPProtocol object for the server
        Since:
        JavaMail 1.6.0
      • SearchSequence

        @Deprecated
        public SearchSequence()
        Deprecated.
        Create a SearchSequence.
    • Method Detail

      • generateSequence

        public Argument generateSequence​(jakarta.mail.search.SearchTerm term,
                                         java.lang.String charset)
                                  throws jakarta.mail.search.SearchException,
                                         java.io.IOException
        Generate the IMAP search sequence for the given search expression.
        Parameters:
        term - the search term
        charset - charset for the search
        Returns:
        the SEARCH Argument
        Throws:
        jakarta.mail.search.SearchException - for failures
        java.io.IOException - for I/O errors
      • isAscii

        public static boolean isAscii​(jakarta.mail.search.SearchTerm term)
        Check if the "text" terms in the given SearchTerm contain non US-ASCII characters.
        Parameters:
        term - the search term
        Returns:
        true if only ASCII
      • isAscii

        public static boolean isAscii​(jakarta.mail.search.SearchTerm[] terms)
        Check if any of the "text" terms in the given SearchTerms contain non US-ASCII characters.
        Parameters:
        terms - the search terms
        Returns:
        true if only ASCII
      • isAscii

        public static boolean isAscii​(java.lang.String s)
        Does this string contain only ASCII characters?
        Parameters:
        s - the string
        Returns:
        true if only ASCII
      • and

        protected Argument and​(jakarta.mail.search.AndTerm term,
                               java.lang.String charset)
                        throws jakarta.mail.search.SearchException,
                               java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • or

        protected Argument or​(jakarta.mail.search.OrTerm term,
                              java.lang.String charset)
                       throws jakarta.mail.search.SearchException,
                              java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • not

        protected Argument not​(jakarta.mail.search.NotTerm term,
                               java.lang.String charset)
                        throws jakarta.mail.search.SearchException,
                               java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • header

        protected Argument header​(jakarta.mail.search.HeaderTerm term,
                                  java.lang.String charset)
                           throws jakarta.mail.search.SearchException,
                                  java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • messageid

        protected Argument messageid​(jakarta.mail.search.MessageIDTerm term,
                                     java.lang.String charset)
                              throws jakarta.mail.search.SearchException,
                                     java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • flag

        protected Argument flag​(jakarta.mail.search.FlagTerm term)
                         throws jakarta.mail.search.SearchException
        Throws:
        jakarta.mail.search.SearchException
      • from

        protected Argument from​(java.lang.String address,
                                java.lang.String charset)
                         throws jakarta.mail.search.SearchException,
                                java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • recipient

        protected Argument recipient​(jakarta.mail.Message.RecipientType type,
                                     java.lang.String address,
                                     java.lang.String charset)
                              throws jakarta.mail.search.SearchException,
                                     java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • subject

        protected Argument subject​(jakarta.mail.search.SubjectTerm term,
                                   java.lang.String charset)
                            throws jakarta.mail.search.SearchException,
                                   java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • body

        protected Argument body​(jakarta.mail.search.BodyTerm term,
                                java.lang.String charset)
                         throws jakarta.mail.search.SearchException,
                                java.io.IOException
        Throws:
        jakarta.mail.search.SearchException
        java.io.IOException
      • size

        protected Argument size​(jakarta.mail.search.SizeTerm term)
                         throws jakarta.mail.search.SearchException
        Throws:
        jakarta.mail.search.SearchException
      • toIMAPDate

        protected java.lang.String toIMAPDate​(java.util.Date date)
      • sentdate

        protected Argument sentdate​(jakarta.mail.search.DateTerm term)
                             throws jakarta.mail.search.SearchException
        Throws:
        jakarta.mail.search.SearchException
      • receiveddate

        protected Argument receiveddate​(jakarta.mail.search.DateTerm term)
                                 throws jakarta.mail.search.SearchException
        Throws:
        jakarta.mail.search.SearchException
      • older

        protected Argument older​(OlderTerm term)
                          throws jakarta.mail.search.SearchException
        Generate argument for OlderTerm.
        Parameters:
        term - the search term
        Returns:
        the SEARCH Argument
        Throws:
        jakarta.mail.search.SearchException - for failures
        Since:
        JavaMail 1.5.1
      • younger

        protected Argument younger​(YoungerTerm term)
                            throws jakarta.mail.search.SearchException
        Generate argument for YoungerTerm.
        Parameters:
        term - the search term
        Returns:
        the SEARCH Argument
        Throws:
        jakarta.mail.search.SearchException - for failures
        Since:
        JavaMail 1.5.1
      • modifiedSince

        protected Argument modifiedSince​(ModifiedSinceTerm term)
                                  throws jakarta.mail.search.SearchException
        Generate argument for ModifiedSinceTerm.
        Parameters:
        term - the search term
        Returns:
        the SEARCH Argument
        Throws:
        jakarta.mail.search.SearchException - for failures
        Since:
        JavaMail 1.5.1