associationEnds lets you inspect the association-end roles connected to a class or association when you work with UML model metadata in MDriven Designer.
What associationEnds does
An association end is one side of a UML association. It describes how one class participates in a relationship, including the role used for that connection.
Use associationEnds when your OCL expression needs to examine the structure of the model rather than normal business objects. For example, you can use it to discover which association-end roles are connected to a class while building model-introspection or documentation logic.
When to use it
Use associationEnds for meta-level OCL: OCL that evaluates model elements and their relationships.
For example, consider a model in which a Customer class is associated with an Order class. The association has ends that represent the roles through which Customer and Order are connected. Applying associationEnds to the relevant model element lets you inspect those association ends and their role names.
This is different from navigating business data. If you need the orders belonging to a particular customer at runtime, navigate the ordinary model association in your business-data expression. Do not use associationEnds for that purpose.
Typical use cases
- Inspect the roles that connect a class to other classes.
- Inspect the ends of a UML association.
- Build model-aware logic that needs to understand relationship structure.
- Support generated documentation or other tooling that examines the model.
associationEnds and associationEndsWithType
associationEnds is intended for inspecting association ends themselves. If you need association names together with type information as strings, use associationEndsWithType instead.
| Need | Use |
|---|---|
| Inspect the association ends and their roles in model metadata | associationEnds
|
| Get association names and type information as strings | associationEndsWithType |
How to work with the operator
- In MDriven Designer, open the OCL editor for the model-level expression you are creating.
- Start from the class or association whose relationship structure you want to inspect.
- Apply
associationEndsto retrieve its connected association ends. - Use the returned association-end information to inspect the roles used by the association.
- If your required result is text containing association names and type information, use associationEndsWithType rather than converting the result yourself.
Scope and limitations
associationEnds is for UML model introspection. It does not retrieve employee records, budgets, orders, or other ordinary business data. Keep model-metadata expressions separate from expressions that navigate instances of your model.
For general help discovering operators in the OCL editor, see Documentation:OCL General Operators.
