5.3.1.1. Model API Model Root
ModelRoot is the highest modelObject in the ModelAPI hierarchy. You will not need to use it unless you have multiple models in your project.
For an image see API hierarchy
5.3.1.1.1. Overview
Modifier and Type |
Method and Description |
---|---|
void |
|
void |
|
List<IMetaDataEntry> |
|
RelationDecorator |
|
String |
|
String |
|
List<IMetaDataEntry> |
|
String |
|
String |
getMetaData(String metaDataKey, boolean throwExceptionIfNotFound) |
String |
|
String |
|
List<RelationDecorator> |
|
String |
|
boolean |
|
boolean |
|
void |
5.3.1.1.2. Details
5.3.1.1.2.1. addMetaData(String key, String value)
void addMetaData(String key, String value)
Description
Adds metadata with a given key to a package, object, attribute or reference.
Freemarker Example
${modelObject.addMetaData("enableCrud", "true")}
5.3.1.1.2.2. addMetaData(String key, String value, String description)
void addMetaData(String key, String value, String description)
Description
Adds metadata with a given key to ModelRoot. It also adds a description.
Example
none
5.3.1.1.2.3. findMetaDataByKey(String expression)
Set<IMetaDataEntry> findMetaDataByKey(String expression) throws InvalidPatternException
Description
Finds Set of metadata by expression.
Example
none
5.3.1.1.2.4. getChilderen()
List<RelationDecorator> getChilderen()
Description
Returns a list of all child model objects of this ModelAPI object instance (Root or Package).
Example
none
5.3.1.1.2.5. getFileComment()
String getFileComment()
Description
Returns the comment String set by the developer for file generation.
Example
none
5.3.1.1.2.6. getKind()
String getKind()
Description
The kind of model element, which is either of the following:
root,
package,
attribute,
reference or
metadata.
This can be a useful tool when performing a type specific action on a list with various types of items.
For the modelRoot getKind() should always return “root”.
Freemarker Example
<#assign shouldBeRoot = modelRoot.kind>
<#if shouldBeRoot == "root">
<#--Do some action which is only intended for an expected root, and not for packages, attributes, references-->
</#if>
5.3.1.1.2.7. getMetaData()
Set<Map.Entry<String,Set<IMetaDataEntry>>> getMetaData()
Description
Get all metdata for this ModelRoot. In Freemarker this would be a list, which you can iterate.
Example
none
5.3.1.1.2.8. getMetaData(String metaDataKey)
String getMetaData(String metaDataKey) throws InvalidPatternException, InvalidPropertyException, PropertyNotFoundException
Description
Metadata finder that throws an exception if something went wrong.
Example
none
5.3.1.1.2.9. getMetaData(String metaDataKey, boolean throwExceptionIfNotFound)
String getMetaData(String metaDataKey, String defaultValue) throws InvalidPatternException
Description
Metadata finder that accepts a key and sets a default value if the metadata property doesn’t exist.
Example
none
5.3.1.1.2.10. getMetaData(String metaDataKey, String defaultValue)
String getMetaData(String metaDataKey, String defaultValue) throws InvalidPatternException
Description
Metadata finder that accepts a key and sets a default value if the metadata property doesn’t exist.
Example
5.3.1.1.2.11. getName()
void getName()
Description
Deprecated. Documented for compatibility reasons only.
Use getAttributeValue(“name”) instead.
Example
none
5.3.1.1.2.12. getParent()
RelationDecorator getParent()
Description
Returns the the parent of this of this ModelAPI object instance (Root or Package).
Example
none
5.3.1.1.2.13. getText()
String getText()
Description
?
Example
none
5.3.1.1.2.14. hasMetaData(String key)
boolean hasMetaData(String key)
Description
Checks if metadata with a given key and value is present in this ModelAPI object instance (Root, Package, Object, Attribute, Reference).
Example
none
5.3.1.1.2.15. hasMetaData(String key, String value)
boolean hasMetaData(String key, String value)
Description
Checks if metadata with a given key and value is present in this ModelAPI object instance (Root, Package, Object, Attribute, Reference).
Example
none
5.3.1.1.2.16. setFileComment(String fileComment)
void setFileComment(String fileComment)
Description
Set the comment String for every generated file.
Example
none
5.3.1.1.2.17. setName(String name)
void setName(String name)
Description
Sets the name of the attribute.
Freemarker example
${modelAttribute.setName("Set a name")
none