Class ActivityQuery
ActivityStore — a small set of filters (session, tab, age, category) plus a cap on how
many of the most recent matches to return.
What this class is for
The activity timeline can hold many entries, but a prompt only wants the handful that matter
right now: usually "the last few things this user did in this tab". An
ActivityQuery is how you say that precisely — scope it to a sessionId() and
tabId(), optionally only keep events
invalid reference
newer thantypes, and cap the count. The store does the
filtering and hands back a chronological list.
Familiar analogy: a search filter on an email client — "from this folder, this label,
newer than yesterday, show 20". You aren't fetching the whole mailbox; you're asking for exactly
the visible, relevant window. ActivityQuery is that filter for the activity log.
Filter semantics
- A
nullsessionId()ortabId()means "don't filter on that field" (match any). A non-null value must match exactly. since()keeps only events at or after that instant;nullmeans no lower bound.types()keeps only events whoseUserActivityEvent.Typeis in the set; an empty set means all types.limit()keeps only the N most recent matches (a value<= 0means "no limit").
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
sessionId
- Returns:
- the session to match exactly, or
nullto match any session.
-
tabId
- Returns:
- the tab to match exactly, or
nullto match any tab.
-
since
- Returns:
- the lower time bound (inclusive), or
nullfor no lower bound.
-
types
- Returns:
- an unmodifiable set of accepted types; empty means "all types". Never
null.
-
limit
public int limit()- Returns:
- the maximum number of most-recent matches to return;
<= 0means no limit.
-
matches
Test whether a single event satisfies this query's field filters.Note this deliberately does not apply
limit()— the limit is about how many matches to keep, which only makes sense over a collection. A store calls this per event to decide membership, then applies the limit to the surviving set.- Parameters:
e- the event to test; must not benull- Returns:
trueif the event passes every field filter
-
builder
- Returns:
- a new, empty
ActivityQuery.Builder.
-
toString
-