-
- All Known Implementing Classes:
DefaultEntities
public interface Entities
A repository specifying theEntityDefinition
s for a given domain. Factory forEntity
andKey
instances.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Entity.Builder
builder(EntityType entityType)
Creates a newEntity.Builder
instance.boolean
contains(EntityType entityType)
EntityDefinition
definition(EntityType entityType)
Returns theEntityDefinition
for the given entityTypeEntityDefinition
definition(String entityTypeName)
Returns theEntityDefinition
for the given entityType nameCollection<EntityDefinition>
definitions()
Returns allEntityDefinition
s availableDomainType
domainType()
Entity
entity(EntityType entityType)
Creates a newEntity
instance with the given entityTypeKey.Builder
keyBuilder(EntityType entityType)
Creates a newKey.Builder
instance for the given entity type.<T> Key
primaryKey(EntityType entityType, T value)
Creates a newKey
instance with the given entityType, initialised with the given value<T> List<Key>
primaryKeys(EntityType entityType, T... values)
Creates newKey
instances with the given entityType, initialised with the given values
-
-
-
Method Detail
-
domainType
DomainType domainType()
- Returns:
- the
DomainType
thisEntities
instance is associated with
-
definition
EntityDefinition definition(EntityType entityType)
Returns theEntityDefinition
for the given entityType- Parameters:
entityType
- the entityType- Returns:
- the entity definition
- Throws:
IllegalArgumentException
- in case the definition is not found
-
definition
EntityDefinition definition(String entityTypeName)
Returns theEntityDefinition
for the given entityType name- Parameters:
entityTypeName
- the name of the entityType- Returns:
- the entity definition
- Throws:
IllegalArgumentException
- in case the definition is not found
-
contains
boolean contains(EntityType entityType)
- Parameters:
entityType
- the entityType- Returns:
- true if this domain contains a definition for the given type
-
definitions
Collection<EntityDefinition> definitions()
Returns allEntityDefinition
s available- Returns:
- all entity definitions
-
entity
Entity entity(EntityType entityType)
Creates a newEntity
instance with the given entityType- Parameters:
entityType
- the entityType- Returns:
- a new
Entity
instance
-
builder
Entity.Builder builder(EntityType entityType)
Creates a newEntity.Builder
instance.- Parameters:
entityType
- the entityType- Returns:
- a new
Entity.Builder
-
primaryKey
<T> Key primaryKey(EntityType entityType, T value)
Creates a newKey
instance with the given entityType, initialised with the given value- Type Parameters:
T
- the key value type- Parameters:
entityType
- the entityTypevalue
- the key value, assumes a single long key- Returns:
- a new
Key
instance - Throws:
IllegalStateException
- in case the given primary key is a composite keyIllegalArgumentException
- in case the value is not of the correct typeNullPointerException
- in case entityType is null
-
primaryKeys
<T> List<Key> primaryKeys(EntityType entityType, T... values)
Creates newKey
instances with the given entityType, initialised with the given values- Type Parameters:
T
- the key value type- Parameters:
entityType
- the entityTypevalues
- the key values, assumes a single integer key- Returns:
- new
Key
instances - Throws:
IllegalStateException
- in case the given primary key is a composite keyIllegalArgumentException
- in case any of the values is not of the correct typeNullPointerException
- in case entityType or values is null
-
keyBuilder
Key.Builder keyBuilder(EntityType entityType)
Creates a newKey.Builder
instance for the given entity type.- Parameters:
entityType
- the entity type- Returns:
- a new builder
-
-