Class Cursor


  • public class Cursor
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Date expiration  
      protected java.lang.String value  
    • Constructor Summary

      Constructors 
      Constructor Description
      Cursor​(java.lang.String value)
      None
      Cursor​(java.lang.String value, java.util.Date expiration)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.util.Date getExpiration()
      Expiration time of getValue().
      java.lang.String getValue()
      The actual cursor value.
      int hashCode()  
      java.lang.String toString()  
      java.lang.String toStringMultiline()
      Returns a String representation of this object formatted for easier readability.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        @Nonnull
        protected final java.lang.String value
      • expiration

        @Nullable
        protected final java.util.Date expiration
    • Constructor Detail

      • Cursor

        public Cursor​(@Nonnull
                      java.lang.String value,
                      @Nullable
                      java.util.Date expiration)
        Parameters:
        value - The actual cursor value. Must not be null.
        expiration - Expiration time of getValue(). Some cursors might have expiration time assigned. This is a UTC value after which the cursor is no longer valid and the API starts returning an error. If cursor expires a new one needs to be obtained and pagination needs to be restarted. Some cursors might be short-lived some cursors might be long-lived. This really depends on the sorting type and order, e.g.: 1. on one hand, listing docs created by the user, sorted by the created time ascending will have undefinite expiration because the results cannot change while the iteration is happening. This cursor would be suitable for long term polling. 2. on the other hand, listing docs sorted by the last modified time will have a very short expiration as docs do get modified very often and the modified time can be changed while the iteration is happening thus altering the results.
        Throws:
        java.lang.IllegalArgumentException - If any argument does not meet its preconditions.
      • Cursor

        public Cursor​(@Nonnull
                      java.lang.String value)
        None

        The default values for unset fields will be used.

        Parameters:
        value - The actual cursor value. Must not be null.
        Throws:
        java.lang.IllegalArgumentException - If any argument does not meet its preconditions.
    • Method Detail

      • getValue

        @Nonnull
        public java.lang.String getValue()
        The actual cursor value.
        Returns:
        value for this field, never null.
      • getExpiration

        @Nullable
        public java.util.Date getExpiration()
        Expiration time of getValue(). Some cursors might have expiration time assigned. This is a UTC value after which the cursor is no longer valid and the API starts returning an error. If cursor expires a new one needs to be obtained and pagination needs to be restarted. Some cursors might be short-lived some cursors might be long-lived. This really depends on the sorting type and order, e.g.: 1. on one hand, listing docs created by the user, sorted by the created time ascending will have undefinite expiration because the results cannot change while the iteration is happening. This cursor would be suitable for long term polling. 2. on the other hand, listing docs sorted by the last modified time will have a very short expiration as docs do get modified very often and the modified time can be changed while the iteration is happening thus altering the results.
        Returns:
        value for this field, or null if not present.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public java.lang.String toStringMultiline()
        Returns a String representation of this object formatted for easier readability.

        The returned String may contain newlines.

        Returns:
        Formatted, multiline String representation of this object