Class DefaultEntities

java.lang.Object
is.codion.framework.domain.entity.DefaultEntities
All Implemented Interfaces:
Entities, Serializable

public abstract class DefaultEntities extends Object implements Entities, Serializable
A default Entities implementation.
See Also:
  • Constructor Details

    • DefaultEntities

      protected DefaultEntities(DomainType domainType)
      Instantiates a new DefaultEntities for the given domainType
      Parameters:
      domainType - the domainType
  • Method Details

    • domainType

      public final DomainType domainType()
      Specified by:
      domainType in interface Entities
      Returns:
      the DomainType this Entities instance is associated with
    • definition

      public final EntityDefinition definition(EntityType entityType)
      Description copied from interface: Entities
      Returns the EntityDefinition for the given entityType
      Specified by:
      definition in interface Entities
      Parameters:
      entityType - the entityType
      Returns:
      the entity definition
    • definition

      public final EntityDefinition definition(String entityTypeName)
      Description copied from interface: Entities
      Returns the EntityDefinition for the given entityType name
      Specified by:
      definition in interface Entities
      Parameters:
      entityTypeName - the name of the entityType
      Returns:
      the entity definition
    • contains

      public final boolean contains(EntityType entityType)
      Specified by:
      contains in interface Entities
      Parameters:
      entityType - the entityType
      Returns:
      true if this domain contains a definition for the given type
    • definitions

      public final Collection<EntityDefinition> definitions()
      Description copied from interface: Entities
      Returns all EntityDefinitions found in this Entities instance
      Specified by:
      definitions in interface Entities
      Returns:
      all entity definitions
    • entity

      public final Entity entity(EntityType entityType)
      Description copied from interface: Entities
      Creates a new empty Entity instance of the given entityType
      Specified by:
      entity in interface Entities
      Parameters:
      entityType - the entityType
      Returns:
      a new Entity instance
    • builder

      public final Entity.Builder builder(EntityType entityType)
      Description copied from interface: Entities
      Creates a new Entity.Builder instance for the given entityType
      Specified by:
      builder in interface Entities
      Parameters:
      entityType - the entityType
      Returns:
      a new Entity.Builder
    • primaryKey

      public final <T> Entity.Key primaryKey(EntityType entityType, T value)
      Description copied from interface: Entities
      Creates a new Entity.Key instance of the given entityType, initialised with the given value
      Specified by:
      primaryKey in interface Entities
      Type Parameters:
      T - the key value type
      Parameters:
      entityType - the entityType
      value - the key value, assumes a single value key
      Returns:
      a new Entity.Key instance
    • primaryKeys

      public final <T> List<Entity.Key> primaryKeys(EntityType entityType, T... values)
      Description copied from interface: Entities
      Creates new Entity.Key instances of the given entityType, initialised with the given values
      Specified by:
      primaryKeys in interface Entities
      Type Parameters:
      T - the key value type
      Parameters:
      entityType - the entityType
      values - the key values, assumes a single value key
      Returns:
      new Entity.Key instances
    • keyBuilder

      public final Entity.Key.Builder keyBuilder(EntityType entityType)
      Description copied from interface: Entities
      Creates a new Entity.Key.Builder instance for the given entity type
      Specified by:
      keyBuilder in interface Entities
      Parameters:
      entityType - the entity type
      Returns:
      a new builder
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • validateForeignKeys

      protected final void validateForeignKeys(boolean validateForeignKeys)
      Specifies whether to validate foreign keys when created, asserting that the referenced entity has been defined. Disable in case of cyclical dependencies.
      Parameters:
      validateForeignKeys - true if foreign keys should be validated
    • add

      protected final void add(EntityDefinition definition)
      Parameters:
      definition - the entity definition to add
      Throws:
      IllegalArgumentException - in case this DefaultEntities instance already contains the given definition