Class EntityFactoryImpl

  • All Implemented Interfaces:
    EntityFactory

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

      • EntityFactoryImpl

        public EntityFactoryImpl()
    • Method Detail

      • getBackends

        public java.util.Collection<org.tentackle.sql.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​(java.util.Collection<org.tentackle.sql.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
      • 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
      • 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​(java.lang.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
      • 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
      • 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
      • setPendingComment

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

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