Model Extensions Usage
Model Extension Files
Once a Model Extension is defined, you can add the instances of your child elementClasses in a subdirectory next to
the other child elements. The name of the subdirectory is the name of the element, starting in lowercase, with suffix
s.
space
└── model
├── space.xml
├── dataElements
└── customElements
├── CustomElement1.xml
└── CustomElement2.xml
For extensions of DataElement, there is a directory for every DataElement containing the extensions:
space
└── model
├── space.xml
└── dataElements
├── Starship.xml
└── Starship
└── customElements
├── CustomElement1.xml
└── CustomElement2.xml
Metamodel expansion also generates an XSD file for each ontology, which can help with writing the XML model files by hand.
Usage in Expanders
Each Composite of an extendable ElementClass has a getExtension(String) method to retrieve extensions by the name of the child ElementClass.
<mapping>
<list name="customElements"
eval="component.getExtension('CustomElement')"
param="customElement">
<value name="name" eval="customElement.name"/>
</list>
</mapping>
If the role of the child element is element, you can also write expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. that target this ElementClass.
<expander name="CustomElementExpander">
<packageName>org.normalizedsystem.custom.expander</packageName>
<layerType name="SHARED_LAYER"/>
<technology name="COMMON"/>
<sourceType name="SRC"/>
<elementType component="demo" name="CustomElement"/>
<artifactName>$customElement.name$.java</artifactName>
<artifactPath>$componentRoot.directory$/$artifactSubFolders$/some/package</artifactPath>
<isApplicable>true</isApplicable>
</expander>