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