Class EntityFactoryImpl

java.lang.Object
org.tentackle.model.impl.EntityFactoryImpl
All Implemented Interfaces:
EntityFactory

public class EntityFactoryImpl extends Object implements EntityFactory
The default entity model factory.
Author:
harald
  • Constructor Details

    • EntityFactoryImpl

      public EntityFactoryImpl()
  • Method Details

    • getBackends

      public Collection<Backend> getBackends()
      Description copied from interface: EntityFactory
      Gets the backends to validate the model against.
      Specified by:
      getBackends in interface EntityFactory
      Returns:
      the backends, empty if check is disabled, never null
    • setBackends

      public void setBackends(Collection<Backend> backends)
      Description copied from interface: EntityFactory
      Sets the backends to validate the model against.
      Specified by:
      setBackends in interface EntityFactory
      Parameters:
      backends - the backends, null to disable check
    • createEntity

      public EntityImpl createEntity(SourceInfo sourceInfo)
      Description copied from interface: EntityFactory
      Creates an empty entity.
      Specified by:
      createEntity in interface EntityFactory
      Parameters:
      sourceInfo - source information, null if none
      Returns:
      the created entity
    • createAttribute

      public AttributeImpl createAttribute(Entity entity, SourceInfo sourceInfo, boolean implicit)
      Description copied from interface: EntityFactory
      Creates an attribute.
      Specified by:
      createAttribute in interface EntityFactory
      Parameters:
      entity - the entity this attribute belongs to
      sourceInfo - source information, null if none
      implicit - true if implicit attribute
      Returns:
      the created attribute
    • createAttributeOptions

      public AttributeOptionsImpl createAttributeOptions(Attribute attribute, SourceInfo sourceInfo)
      Description copied from interface: EntityFactory
      Creates attribute options.
      Specified by:
      createAttributeOptions in interface EntityFactory
      Parameters:
      attribute - the attribute
      sourceInfo - source information, null if none
      Returns:
      the created options
    • createEntityOptions

      public EntityOptionsImpl createEntityOptions(Entity entity, SourceInfo sourceInfo)
      Description copied from interface: EntityFactory
      Creates entity options.
      Specified by:
      createEntityOptions in interface EntityFactory
      Parameters:
      entity - the entity
      sourceInfo - source information, null if none
      Returns:
      the created options
    • createIndex

      public IndexImpl createIndex(Entity entity, SourceInfo sourceInfo)
      Description copied from interface: EntityFactory
      Creates an index.
      Specified by:
      createIndex in interface EntityFactory
      Parameters:
      entity - the entity this index belongs to
      sourceInfo - source information, null if none
      Returns:
      the created index
    • createIndexAttribute

      public IndexAttributeImpl createIndexAttribute(Index index)
      Description copied from interface: EntityFactory
      Creates an index attribute.
      Specified by:
      createIndexAttribute in interface EntityFactory
      Parameters:
      index - the index
      Returns:
      the created index attribute
    • createRelation

      public RelationImpl createRelation(Entity entity, SourceInfo sourceInfo)
      Description copied from interface: EntityFactory
      Creates a relation.
      Specified by:
      createRelation in interface EntityFactory
      Parameters:
      entity - the entity this relation belongs to
      sourceInfo - source information, null if none
      Returns:
      the created relation
    • createEntity

      public Entity createEntity(String model, ModelDefaults modelDefaults) throws ModelException
      Description copied from interface: EntityFactory
      Creates an entity from a model source.
      Specified by:
      createEntity in interface EntityFactory
      Parameters:
      model - the model source
      modelDefaults - the model defaults, null if none
      Returns:
      the created entity
      Throws:
      ModelException - if parsing the model failed
    • processConfiguration

      protected void processConfiguration(EntityImpl entity, ConfigurationLine line) throws ModelException
      Processes a configuration line.
      Parameters:
      entity - the entity
      line - the configuration line
      Throws:
      ModelException - if processing failed
    • processIndexConfiguration

      protected void processIndexConfiguration(EntityImpl entity, ConfigurationLine line)
      Processes an index configuration line.
      Requires the attribute already processed.
      Parameters:
      entity - the entity
      line - the configuration line
    • processGlobalOptions

      protected void processGlobalOptions(EntityImpl entity, GlobalOptionLine line) throws ModelException
      Processes a global option line.
      Parameters:
      entity - the entity
      line - the global option line
      Throws:
      ModelException - if processing failed
    • processAttributeOption

      protected void processAttributeOption(EntityImpl entity, OptionLine line) throws ModelException
      Processes an attribute option line.
      Parameters:
      entity - the entity
      line - the attribute option line
      Throws:
      ModelException - if processing failed
    • processRelationOption

      protected void processRelationOption(EntityImpl entity, OptionLine line) throws ModelException
      Processes a relation option line.
      Parameters:
      entity - the entity
      line - the attribute option line
      Throws:
      ModelException - if processing failed
    • processAttribute

      protected void processAttribute(EntityImpl entity, AttributeLine line) throws ModelException
      Processes an attribute line.
      Parameters:
      entity - the entity
      line - the attribute line
      Throws:
      ModelException - if processing failed
    • processRelation

      protected void processRelation(EntityImpl entity, RelationLine line) throws ModelException
      Processes a relation line.
      Parameters:
      entity - the entity
      line - the relation line
      Throws:
      ModelException - if processing failed
    • setPendingComment

      protected void setPendingComment(String commentLine)
      Adds a pending comment line.
      Parameters:
      commentLine - the comment line
    • consumePendingComment

      protected String consumePendingComment()
      Returns the pending comment and consumes it.
      Returns:
      the pending comment, null if none