Search code examples
javaecore

How to create custom attributes in EMF Ecore Modeling Framework


In our project, we aim to model a system with series of components, with each component having a list of inputs and outputs. We want to differentiate inputs and outputs so we don't want it to be a big list of EFloats, rather we want to create a custom data type that defines the property as an input or output as well as contains the unit of measure for the value.

We created custom data classes in the Ecore model but can't assign them to the components since the attributes list contains default Ecore attributes.

Searching for "custom ecore attributes" returns results of general Ecore modeling information that doesn't quite address our question.


Solution

  • If the "custom data classes" you have created are EClasses, then you can assign them to the components via an "EReference". If they are custom data types, then you can assign them via an "EAttribute". Does that help?