Package com.fauna.event
Class FeedPage.Builder<E>
- java.lang.Object
-
- com.fauna.event.FeedPage.Builder<E>
-
-
Constructor Summary
Constructors Constructor Description Builder(Codec<E> elementCodec, StatsCollector statsCollector)Constructs aBuilderwith the specified codec and stats collector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FeedPage<E>build()Builds a newFeedPageinstance with the configured parameters.FeedPage.Builder<E>cursor(java.lang.String cursor)Sets the cursor for pagination.FeedPage.Builder<E>events(java.util.List<FaunaEvent<E>> events)Sets the list of events for the feed page.FeedPage.Builder<E>hasNext(java.lang.Boolean hasNext)Sets the flag indicating if there are more pages available.FeedPage.Builder<E>parseEvents(com.fasterxml.jackson.core.JsonParser parser)Parses and sets the list of events from the provided JSON parser.FeedPage.Builder<E>parseField(com.fasterxml.jackson.core.JsonParser parser)Parses and sets the appropriate field in the builder based on the JSON parser's current field.FeedPage.Builder<E>stats(QueryStats stats)Sets the statistics for the feed page.
-
-
-
Constructor Detail
-
Builder
public Builder(Codec<E> elementCodec, StatsCollector statsCollector)
Constructs aBuilderwith the specified codec and stats collector.- Parameters:
elementCodec- TheCodecused to decode events.statsCollector- TheStatsCollectorto gather statistics for the feed.
-
-
Method Detail
-
events
public FeedPage.Builder<E> events(java.util.List<FaunaEvent<E>> events)
Sets the list of events for the feed page.- Parameters:
events- A list ofFaunaEventobjects representing the events in this page.- Returns:
- This
Builderinstance.
-
cursor
public FeedPage.Builder<E> cursor(java.lang.String cursor)
Sets the cursor for pagination.- Parameters:
cursor- AStringrepresenting the cursor.- Returns:
- This
Builderinstance.
-
hasNext
public FeedPage.Builder<E> hasNext(java.lang.Boolean hasNext)
Sets the flag indicating if there are more pages available.- Parameters:
hasNext- ABooleanindicating if there are more pages.- Returns:
- This
Builderinstance.
-
stats
public FeedPage.Builder<E> stats(QueryStats stats)
Sets the statistics for the feed page.- Parameters:
stats- AQueryStatsobject containing statistics for the page.- Returns:
- This
Builderinstance.
-
parseEvents
public FeedPage.Builder<E> parseEvents(com.fasterxml.jackson.core.JsonParser parser) throws java.io.IOException
Parses and sets the list of events from the provided JSON parser.- Parameters:
parser- TheJsonParserto decode the events from.- Returns:
- This
Builderinstance. - Throws:
java.io.IOException- if an error occurs during parsing.
-
build
public FeedPage<E> build()
Builds a newFeedPageinstance with the configured parameters.- Returns:
- A new
FeedPageinstance. - Throws:
java.lang.IllegalArgumentException- ifeventsis null orcursoris blank.
-
parseField
public FeedPage.Builder<E> parseField(com.fasterxml.jackson.core.JsonParser parser) throws java.io.IOException
Parses and sets the appropriate field in the builder based on the JSON parser's current field.- Parameters:
parser- TheJsonParserfor reading the field value.- Returns:
- The updated
Builderinstance. - Throws:
java.io.IOException- if an error occurs during parsing.
-
-