Package com.fauna.event
Class FeedPage<E>
- java.lang.Object
-
- com.fauna.event.FeedPage<E>
-
- Type Parameters:
E- The type of data contained in each event.
public class FeedPage<E> extends java.lang.ObjectRepresents a page of events from an Event Feed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFeedPage.Builder<E>Builder class for constructingFeedPageinstances.
-
Constructor Summary
Constructors Constructor Description FeedPage(java.util.List<FaunaEvent<E>> events, java.lang.String cursor, boolean hasNext, QueryStats stats)Constructs aFeedPagewith the specified events, cursor, pagination flag, and statistics.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <E> FeedPage.Builder<E>builder(Codec<E> elementCodec, StatsCollector statsCollector)Creates a newBuilderfor constructing aFeedPage.java.lang.StringgetCursor()Retrieves the cursor for pagination.java.util.List<FaunaEvent<E>>getEvents()Retrieves the list of events in this feed page.QueryStatsgetStats()Retrieves the statistics for this feed page.booleanhasNext()Checks if there are more pages available.static <E> FeedPage<E>parseResponse(java.net.http.HttpResponse<java.io.InputStream> response, Codec<E> elementCodec, StatsCollector statsCollector)Parses an HTTP response and constructs aFeedPageinstance.
-
-
-
Constructor Detail
-
FeedPage
public FeedPage(java.util.List<FaunaEvent<E>> events, java.lang.String cursor, boolean hasNext, QueryStats stats)
Constructs aFeedPagewith the specified events, cursor, pagination flag, and statistics.- Parameters:
events- A list ofFaunaEventobjects representing the events in this page.cursor- AStringrepresenting the cursor for pagination.hasNext- Abooleanindicating if there are more pages available.stats- AQueryStatsobject containing statistics for the page.- Throws:
java.lang.IllegalArgumentException- ifeventsis null orcursoris blank.
-
-
Method Detail
-
getEvents
public java.util.List<FaunaEvent<E>> getEvents()
Retrieves the list of events in this feed page.- Returns:
- A
ListofFaunaEventobjects.
-
getCursor
public java.lang.String getCursor()
Retrieves the cursor for pagination.- Returns:
- A
Stringrepresenting the cursor.
-
hasNext
public boolean hasNext()
Checks if there are more pages available.- Returns:
trueif there are more pages,falseotherwise.
-
getStats
public QueryStats getStats()
Retrieves the statistics for this feed page.- Returns:
- A
QueryStatsobject.
-
builder
public static <E> FeedPage.Builder<E> builder(Codec<E> elementCodec, StatsCollector statsCollector)
Creates a newBuilderfor constructing aFeedPage.- Type Parameters:
E- The type of data contained in each event.- Parameters:
elementCodec- TheCodecused to decode events.statsCollector- TheStatsCollectorto gather statistics.- Returns:
- A new
Builderinstance.
-
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 aFeedPageinstance.- Type Parameters:
E- The type of data contained in each event.- Parameters:
response- TheHttpResponsecontaining the feed data.elementCodec- TheCodecused to decode events.statsCollector- TheStatsCollectorto gather statistics.- Returns:
- The parsed
FeedPage. - Throws:
ClientResponseException- if an error occurs while parsing the feed response.
-
-