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 aBuilder
with the specified codec and stats collector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FeedPage<E>
build()
Builds a newFeedPage
instance 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 aBuilder
with the specified codec and stats collector.- Parameters:
elementCodec
- TheCodec
used to decode events.statsCollector
- TheStatsCollector
to 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 ofFaunaEvent
objects representing the events in this page.- Returns:
- This
Builder
instance.
-
cursor
public FeedPage.Builder<E> cursor(java.lang.String cursor)
Sets the cursor for pagination.- Parameters:
cursor
- AString
representing the cursor.- Returns:
- This
Builder
instance.
-
hasNext
public FeedPage.Builder<E> hasNext(java.lang.Boolean hasNext)
Sets the flag indicating if there are more pages available.- Parameters:
hasNext
- ABoolean
indicating if there are more pages.- Returns:
- This
Builder
instance.
-
stats
public FeedPage.Builder<E> stats(QueryStats stats)
Sets the statistics for the feed page.- Parameters:
stats
- AQueryStats
object containing statistics for the page.- Returns:
- This
Builder
instance.
-
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
- TheJsonParser
to decode the events from.- Returns:
- This
Builder
instance. - Throws:
java.io.IOException
- if an error occurs during parsing.
-
build
public FeedPage<E> build()
Builds a newFeedPage
instance with the configured parameters.- Returns:
- A new
FeedPage
instance. - Throws:
java.lang.IllegalArgumentException
- ifevents
is null orcursor
is 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
- TheJsonParser
for reading the field value.- Returns:
- The updated
Builder
instance. - Throws:
java.io.IOException
- if an error occurs during parsing.
-
-