@NotThreadSafe
public class EntityCollectionDAOBuilder
extends java.lang.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<java.lang.Long> attr)
Add an attribute to index by default on all entities.
|
EntityCollectionDAOBuilder |
addEntities(Entity... entities)
Add multiple entities.
|
EntityCollectionDAOBuilder |
addEntities(java.lang.Iterable<? extends Entity> entities)
Add multiple entities.
|
EntityCollectionDAOBuilder |
addEntity(Entity e)
Add an entity to the DAO.
|
EntityCollectionDAOBuilder |
addEntityLayout(EntityType et,
AttributeSet attributes)
Set a layout for an entity type.
|
EntityCollectionDAOBuilder |
addEntityLayout(EntityType et,
AttributeSet attributes,
java.lang.Class<? extends EntityBuilder> ebc)
Set a layout for an entity type.
|
EntityCollectionDAOBuilder |
addIndex(EntityType et,
TypedName<?> attr)
Index entities by an attribute.
|
EntityCollectionDAO |
build() |
EntityCollectionDAOBuilder |
deriveEntities(EntityType derived,
EntityType source,
TypedName<java.lang.Long> attr)
Derive bare entities from the values in another type of entity.
|
java.util.Set<EntityType> |
getEntityTypes()
Get the entity types registered with this builder so far.
|
public EntityCollectionDAOBuilder addEntityLayout(EntityType et, AttributeSet attributes)
Set a layout for an entity type. A layout limits the possible attributes of entities of that type, but can result in more efficient storage.
et
- The entity type.attributes
- The set of known attributes.java.lang.IllegalStateException
- if the specified entity type already has a layout or entities.public EntityCollectionDAOBuilder addEntityLayout(EntityType et, AttributeSet attributes, java.lang.Class<? extends EntityBuilder> ebc)
Set a layout for an entity type. A layout limits the possible attributes of entities of that type, but can result in more efficient storage.
et
- The entity type.attributes
- The set of known attributes.ebc
- The entity builder class for reconstituting entities.java.lang.IllegalStateException
- if the specified entity type already has a layout or entities.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<java.lang.Long> attr)
Add an attribute to index by default on all entities.
attr
- The attribute to index.public java.util.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(java.lang.Iterable<? extends Entity> entities)
Add multiple entities.
entities
- The entity list.public EntityCollectionDAOBuilder deriveEntities(EntityType derived, EntityType source, TypedName<java.lang.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 entities, 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()