java.lang.Object
org.tentackle.model.impl.EntityFactoryImpl
- All Implemented Interfaces:
EntityFactory
The default entity model factory.
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringReturns the pending comment and consumes it.createAttribute(Entity entity, SourceInfo sourceInfo, boolean implicit) Creates an attribute.createAttributeOptions(Attribute attribute, SourceInfo sourceInfo) Creates attribute options.createEntity(Document document, ModelDefaults modelDefaults) Creates an entity from a model source.createEntity(SourceInfo sourceInfo) Creates an empty entity.createEntityOptions(Entity entity, SourceInfo sourceInfo) Creates entity options.createIndex(Entity entity, SourceInfo sourceInfo) Creates an index.createIndexAttribute(Index index) Creates an index attribute.createRelation(Entity entity, SourceInfo sourceInfo) Creates a relation.Gets the backends to validate the model against.protected voidprocessAttribute(EntityImpl entity, AttributeLine line) Processes an attribute line.protected voidprocessAttributeOption(EntityImpl entity, OptionLine line) Processes an attribute option line.protected voidprocessConfiguration(EntityImpl entity, ConfigurationLine line) Processes a configuration line.protected voidprocessGlobalOptions(EntityImpl entity, GlobalOptionLine line) Processes a global option line.protected voidprocessIndexConfiguration(EntityImpl entity, ConfigurationLine line) Processes an index configuration line.
Requires the attribute already processed.protected voidprocessRelation(EntityImpl entity, RelationLine line) Processes a relation line.protected voidprocessRelationOption(EntityImpl entity, OptionLine line) Processes a relation option line.voidsetBackends(Collection<Backend> backends) Sets the backends to validate the model against.protected voidsetPendingComment(String commentLine) Adds a pending comment line.
-
Constructor Details
-
EntityFactoryImpl
public EntityFactoryImpl()Creates the entity factory.
-
-
Method Details
-
getBackends
Description copied from interface:EntityFactoryGets the backends to validate the model against.- Specified by:
getBackendsin interfaceEntityFactory- Returns:
- the backends, empty if check is disabled, never null
-
setBackends
Description copied from interface:EntityFactorySets the backends to validate the model against.- Specified by:
setBackendsin interfaceEntityFactory- Parameters:
backends- the backends, null to disable check
-
createEntity
Description copied from interface:EntityFactoryCreates an empty entity.- Specified by:
createEntityin interfaceEntityFactory- Parameters:
sourceInfo- source information, null if none- Returns:
- the created entity
-
createAttribute
Description copied from interface:EntityFactoryCreates an attribute.- Specified by:
createAttributein interfaceEntityFactory- Parameters:
entity- the entity this attribute belongs tosourceInfo- source information, null if noneimplicit- true if implicit attribute- Returns:
- the created attribute
-
createAttributeOptions
Description copied from interface:EntityFactoryCreates attribute options.- Specified by:
createAttributeOptionsin interfaceEntityFactory- Parameters:
attribute- the attributesourceInfo- source information, null if none- Returns:
- the created options
-
createEntityOptions
Description copied from interface:EntityFactoryCreates entity options.- Specified by:
createEntityOptionsin interfaceEntityFactory- Parameters:
entity- the entitysourceInfo- source information, null if none- Returns:
- the created options
-
createIndex
Description copied from interface:EntityFactoryCreates an index.- Specified by:
createIndexin interfaceEntityFactory- Parameters:
entity- the entity this index belongs tosourceInfo- source information, null if none- Returns:
- the created index
-
createIndexAttribute
Description copied from interface:EntityFactoryCreates an index attribute.- Specified by:
createIndexAttributein interfaceEntityFactory- Parameters:
index- the index- Returns:
- the created index attribute
-
createRelation
Description copied from interface:EntityFactoryCreates a relation.- Specified by:
createRelationin interfaceEntityFactory- Parameters:
entity- the entity this relation belongs tosourceInfo- source information, null if none- Returns:
- the created relation
-
createEntity
Description copied from interface:EntityFactoryCreates an entity from a model source.- Specified by:
createEntityin interfaceEntityFactory- Parameters:
document- the model source documentmodelDefaults- 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 entityline- the configuration line- Throws:
ModelException- if processing failed
-
processIndexConfiguration
Processes an index configuration line.
Requires the attribute already processed.- Parameters:
entity- the entityline- the configuration line
-
processGlobalOptions
Processes a global option line.- Parameters:
entity- the entityline- the global option line- Throws:
ModelException- if processing failed
-
processAttributeOption
Processes an attribute option line.- Parameters:
entity- the entityline- the attribute option line- Throws:
ModelException- if processing failed
-
processRelationOption
Processes a relation option line.- Parameters:
entity- the entityline- the attribute option line- Throws:
ModelException- if processing failed
-
processAttribute
Processes an attribute line.- Parameters:
entity- the entityline- the attribute line- Throws:
ModelException- if processing failed
-
processRelation
Processes a relation line.- Parameters:
entity- the entityline- the relation line- Throws:
ModelException- if processing failed
-
setPendingComment
Adds a pending comment line.- Parameters:
commentLine- the comment line
-
consumePendingComment
Returns the pending comment and consumes it.- Returns:
- the pending comment, null if none
-