@NotThreadSafe public class EntityCollectionDAOBuilder extends Object
Builder for entity collection DAOs. These builders are destructive: their build()
method cannot be called more than once.
Constructor and Description |
---|
EntityCollectionDAOBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
addDefaultIndex(TypedName<Long> attr)
Add an attribute to index by default on all entities.
|
EntityCollectionDAOBuilder |
addEntities(Entity... entities)
Add multiple entities.
|
EntityCollectionDAOBuilder |
addEntities(Iterable<? extends Entity> entities)
Add multiple entities.
|
EntityCollectionDAOBuilder |
addEntity(Entity e)
Add an entity to the DAO.
|
EntityCollectionDAOBuilder |
addIndex(EntityType et,
TypedName<?> attr)
Index entities by an attribute.
|
EntityCollectionDAO |
build() |
EntityCollectionDAOBuilder |
deriveEntities(EntityType derived,
EntityType source,
TypedName<Long> attr)
Derive bare entities from the values in another type of entity.
|
Set<EntityType> |
getEntityTypes()
Get the entity types registered with this builder so far.
|
public EntityCollectionDAOBuilder addIndex(EntityType et, TypedName<?> attr)
Index entities by an attribute.
et
- The entity type.attr
- The attribute to index.public void addDefaultIndex(TypedName<Long> attr)
Add an attribute to index by default on all entities.
attr
- The attribute to index.public Set<EntityType> getEntityTypes()
Get the entity types registered with this builder so far.
public EntityCollectionDAOBuilder addEntity(Entity e)
Add an entity to the DAO.
e
- The entity to addpublic EntityCollectionDAOBuilder addEntities(Entity... entities)
Add multiple entities.
entities
- The entity list.public EntityCollectionDAOBuilder addEntities(Iterable<? extends Entity> entities)
Add multiple entities.
entities
- The entity list.public EntityCollectionDAOBuilder deriveEntities(EntityType derived, EntityType source, TypedName<Long> attr)
Derive bare entities from the values in another type of entity. This method only consults the entities added so far, so it should be called after all other calls to addEntity(Entity)
and friends. If an entity has already been added with the same type and ID as one of the derived entites, it is kept instead of the derived entity.
derived
- The derived entity type.source
- The source entity type.attr
- The source attribute.public EntityCollectionDAO build()