public final class PrefetchingItemEventDAO extends Object implements ItemEventDAO, Describable
Constructor and Description |
---|
PrefetchingItemEventDAO(EventDAO dao) |
Modifier and Type | Method and Description |
---|---|
void |
describeTo(DescriptionWriter writer)
Write this class's description to a sink.
|
List<Event> |
getEventsForItem(long item)
Get the events for a specific item.
|
<E extends Event> |
getEventsForItem(long item,
Class<E> type)
Get the events for a specific item, filtering by type.
|
LongSet |
getUsersForItem(long item)
Get the users who have interacted with an item.
|
Cursor<ItemEventCollection<Event>> |
streamEventsByItem()
Stream events grouped by item.
|
<E extends Event> |
streamEventsByItem(Class<E> type)
Stream events grouped by item.
|
static Function<EventDAO,ItemEventDAO> |
wrapper()
A function that wraps an event DAO in a prefetching item event DAO.
|
@Inject public PrefetchingItemEventDAO(EventDAO dao)
public static Function<EventDAO,ItemEventDAO> wrapper()
ItemEventDAO
, it is returned unwrapped.public Cursor<ItemEventCollection<Event>> streamEventsByItem()
ItemEventDAO
streamEventsByItem
in interface ItemEventDAO
public <E extends Event> Cursor<ItemEventCollection<E>> streamEventsByItem(Class<E> type)
ItemEventDAO
streamEventsByItem
in interface ItemEventDAO
type
- The type of item to look for.type
from all items. If an item
exists but does not have any events, it may or may not be included depending on the
DAO implementation.public List<Event> getEventsForItem(long item)
ItemEventDAO
getEventsForItem
in interface ItemEventDAO
item
- The item ID.null
if the item is unknown.public <E extends Event> List<E> getEventsForItem(long item, Class<E> type)
ItemEventDAO
getEventsForItem
in interface ItemEventDAO
item
- The item ID.type
- The type of events to retrieve.null
if the item is unknown.public LongSet getUsersForItem(long item)
ItemEventDAO
getUsersForItem
in interface ItemEventDAO
item
- The item ID.null
if the item
is unknown.public void describeTo(DescriptionWriter writer)
Describable
describeTo
in interface Describable
writer
- The description writer to use.