public class EntityCollectionDAO extends AbstractDataAccessObject implements Describable
A DAO backed by one or more collections of entities.
| Modifier and Type | Method and Description |
|---|---|
static EntityCollectionDAO |
create(Collection<? extends Entity> data)
Create a new event collection DAO.
|
static EntityCollectionDAO |
create(Entity... data)
Create a new event collection DAO.
|
void |
describeTo(DescriptionWriter writer)
Write this class’s description to a sink.
|
LongSet |
getEntityIds(EntityType type)
Get the IDs of all entities with a particular type.
|
Set<EntityType> |
getEntityTypes()
Get the types of entities that are available in this DAO.
|
Entity |
lookupEntity(EntityType type,
long id)
Look up an entity by ID.
|
<E extends Entity> |
lookupEntity(EntityType type,
long id,
Class<E> view)
Look up an entity by ID and project it to a view class.
|
static EntityCollectionDAOBuilder |
newBuilder()
Create a new DAO builder.
|
<E extends Entity> |
streamEntities(EntityQuery<E> query)
Stream entities in response to a query.
|
ObjectStream<Entity> |
streamEntities(EntityType type)
Stream all entities of a particular type.
|
query, query, streamEntityGroupspublic static EntityCollectionDAOBuilder newBuilder()
Create a new DAO builder.
public static EntityCollectionDAO create(Entity... data)
Create a new event collection DAO.
data - The data to store in the DAO.public static EntityCollectionDAO create(Collection<? extends Entity> data)
Create a new event collection DAO.
data - The data to store in the DAO.public Set<EntityType> getEntityTypes()
DataAccessObjectGet the types of entities that are available in this DAO.
getEntityTypes in interface DataAccessObjectpublic LongSet getEntityIds(EntityType type)
DataAccessObjectGet the IDs of all entities with a particular type.
getEntityIds in interface DataAccessObjecttype - The entity type.@Nullable public Entity lookupEntity(EntityType type, long id)
DataAccessObjectLook up an entity by ID.
lookupEntity in interface DataAccessObjecttype - The entity type.id - The entity ID.null if no such entity exists.@Nullable public <E extends Entity> E lookupEntity(EntityType type, long id, Class<E> view)
DataAccessObjectLook up an entity by ID and project it to a view class.
lookupEntity in interface DataAccessObjecttype - The entity type.id - The entity ID.view - The view class.null if no such entity exists.public ObjectStream<Entity> streamEntities(EntityType type)
AbstractDataAccessObjectStream all entities of a particular type.
This implementation delegates to DataAccessObject.streamEntities(EntityQuery)
streamEntities in interface DataAccessObjectstreamEntities in class AbstractDataAccessObjecttype - The entity type.public <E extends Entity> ObjectStream<E> streamEntities(EntityQuery<E> query)
DataAccessObjectStream entities in response to a query.
streamEntities in interface DataAccessObjectquery - The query.public void describeTo(DescriptionWriter writer)
DescribableWrite this class’s description to a sink. Anything relevant to this object’s identity should be digested; the idea is that, barring hash collisions, two objects with the same digest are equivalent. Used for things like deterministically generating cache file names.
describeTo in interface Describablewriter - The description writer to use.