Class FeedOptions


  • public class FeedOptions
    extends java.lang.Object
    Represents the options for configuring an Event Feed request in Fauna.

    The FeedOptions class provides configuration parameters such as cursor, start timestamp, page size, and timeout for retrieving feeds from Fauna.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  FeedOptions.Builder
      Builder class for constructing FeedOptions instances.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static FeedOptions DEFAULT
      The default FeedOptions instance with default settings.
    • Constructor Summary

      Constructors 
      Constructor Description
      FeedOptions​(java.lang.String cursor, java.lang.Long startTs, java.lang.Integer pageSize, java.time.Duration timeout)
      Constructs a new FeedOptions with the specified parameters.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static FeedOptions.Builder builder()
      Creates a new Builder for constructing FeedOptions.
      java.util.Optional<java.lang.String> getCursor()
      Retrieves the cursor.
      java.util.Optional<java.lang.Integer> getPageSize()
      Retrieves the page size.
      java.util.Optional<java.lang.Long> getStartTs()
      Retrieves the start timestamp.
      java.util.Optional<java.time.Duration> getTimeout()
      Retrieves the timeout duration.
      FeedOptions nextPage​(FeedPage<?> page)
      Returns the FeedOptions for the next page, based on the cursor of the given page.
      • Methods inherited from class java.lang.Object

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

      • DEFAULT

        public static final FeedOptions DEFAULT
        The default FeedOptions instance with default settings.
    • Constructor Detail

      • FeedOptions

        public FeedOptions​(java.lang.String cursor,
                           java.lang.Long startTs,
                           java.lang.Integer pageSize,
                           java.time.Duration timeout)
        Constructs a new FeedOptions with the specified parameters.
        Parameters:
        cursor - A String representing the cursor in the feed. Cannot be provided with a startTs.
        startTs - A Long representing the start timestamp for the feed. Represents a time in microseconds since the Unix epoch. Cannot be provided with a cursor.
        pageSize - An Integer specifying the number of items per feed page.
        timeout - A Duration specifying the timeout for the feed request.
        Throws:
        java.lang.IllegalArgumentException - if both cursor and startTs are set.
    • Method Detail

      • getCursor

        public java.util.Optional<java.lang.String> getCursor()
        Retrieves the cursor.
        Returns:
        An Optional containing the cursor, or empty if not set.
      • getStartTs

        public java.util.Optional<java.lang.Long> getStartTs()
        Retrieves the start timestamp.
        Returns:
        An Optional containing the start timestamp, or empty if not set.
      • getPageSize

        public java.util.Optional<java.lang.Integer> getPageSize()
        Retrieves the page size.
        Returns:
        An Optional containing the page size, or empty if not set.
      • getTimeout

        public java.util.Optional<java.time.Duration> getTimeout()
        Retrieves the timeout duration.
        Returns:
        An Optional containing the timeout duration, or empty if not set.
      • builder

        public static FeedOptions.Builder builder()
        Creates a new Builder for constructing FeedOptions.
        Returns:
        A new Builder instance.
      • nextPage

        public FeedOptions nextPage​(FeedPage<?> page)
        Returns the FeedOptions for the next page, based on the cursor of the given page.

        This method copies options like page size and timeout, but does not set or copy startTs, because it uses the cursor.

        Parameters:
        page - The current or latest FeedPage.
        Returns:
        A new FeedOptions instance configured for the next page.