mykek.com Eclipse Resources: EMF tips
- Attributes with non-simple types
It is important to understand that an attribute of non-basic type
(i.e. an attribute with a Java class as the type) is
equivalent to a containment relationship with the
first Java class as the parent and the class of the attribute as
the child. EMF will attempt to automatically maintain relationship
integrity between these two classes. This plus the fact that no
object instance can participate in 2 containment relationship at
once could lead to some unexpected results when setting the
attribute on the first Java class.
- Multiple gen model from a single UML model.
Sometimes it is useful to separate a model into multiple,
independent packages/Eclipse plugins. Instead of modeling the java
package hierarchy in the model file, it is often better to have
only the "lowest" level package, and use the base package EMF
attribute to select what fully qualified Java package to map
to. This way, during the generation process, the EMF tooling will
allow the programmer to select which packages to include.
Written by Mike