Class FeedPage<E>

  • Type Parameters:
    E - The type of data contained in each event.

    public class FeedPage<E>
    extends java.lang.Object
    Represents a page of events from an Event Feed.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  FeedPage.Builder<E>
      Builder class for constructing FeedPage instances.
    • Constructor Summary

      Constructors 
      Constructor Description
      FeedPage​(java.util.List<FaunaEvent<E>> events, java.lang.String cursor, boolean hasNext, QueryStats stats)
      Constructs a FeedPage with the specified events, cursor, pagination flag, and statistics.
    • Constructor Detail

      • FeedPage

        public FeedPage​(java.util.List<FaunaEvent<E>> events,
                        java.lang.String cursor,
                        boolean hasNext,
                        QueryStats stats)
        Constructs a FeedPage with the specified events, cursor, pagination flag, and statistics.
        Parameters:
        events - A list of FaunaEvent objects representing the events in this page.
        cursor - A String representing the cursor for pagination.
        hasNext - A boolean indicating if there are more pages available.
        stats - A QueryStats object containing statistics for the page.
        Throws:
        java.lang.IllegalArgumentException - if events is null or cursor is blank.
    • Method Detail

      • getEvents

        public java.util.List<FaunaEvent<E>> getEvents()
        Retrieves the list of events in this feed page.
        Returns:
        A List of FaunaEvent objects.
      • getCursor

        public java.lang.String getCursor()
        Retrieves the cursor for pagination.
        Returns:
        A String representing the cursor.
      • hasNext

        public boolean hasNext()
        Checks if there are more pages available.
        Returns:
        true if there are more pages, false otherwise.
      • getStats

        public QueryStats getStats()
        Retrieves the statistics for this feed page.
        Returns:
        A QueryStats object.
      • builder

        public static <E> FeedPage.Builder<E> builder​(Codec<E> elementCodec,
                                                      StatsCollector statsCollector)
        Creates a new Builder for constructing a FeedPage.
        Type Parameters:
        E - The type of data contained in each event.
        Parameters:
        elementCodec - The Codec used to decode events.
        statsCollector - The StatsCollector to gather statistics.
        Returns:
        A new Builder instance.
      • parseResponse

        public static <E> FeedPage<E> parseResponse​(java.net.http.HttpResponse<java.io.InputStream> response,
                                                    Codec<E> elementCodec,
                                                    StatsCollector statsCollector)
        Parses an HTTP response and constructs a FeedPage instance.
        Type Parameters:
        E - The type of data contained in each event.
        Parameters:
        response - The HttpResponse containing the feed data.
        elementCodec - The Codec used to decode events.
        statsCollector - The StatsCollector to gather statistics.
        Returns:
        The parsed FeedPage.
        Throws:
        ClientResponseException - if an error occurs while parsing the feed response.