🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators associationEndsWithType
This page was created by Lars.olofsson on 2019-10-31. Last edited by Wikiadmin on 2026-07-29.

You can use associationEndsWithType when inspecting an MDriven model in OCL and you need association-end names together with their type information.

What it returns

associationEndsWithType returns a collection of strings. Each string contains an association name and type information for an association end.

This is model metadata: it describes associations and their ends rather than evaluating the ordinary attribute values of an object.

For example, if your model contains an association between Customer and Order, the returned collection contains string information that identifies the relevant association end and its type. Use the returned strings when you need to inspect or validate the association structure in the model.

Use the result

Use collection operations to test or process the returned values.

  1. Evaluate associationEndsWithType in the OCL context where you are inspecting model metadata.
  2. Store the result in, or pass it to, an expression that expects a collection of strings.
  3. Use collection predicates when you need to check whether the collection has entries. For example, use isEmpty to test whether the result contains no association-end information.

The exact text format of each returned string is not defined here. Do not build expressions that depend on punctuation or a presumed ordering of the strings unless you have verified that format in your model and target runtime.

Relationship to type inspection

associationEndsWithType reports association-end metadata. It is not a runtime type test for an object.

Use the following operators for inheritance-related questions instead:

Need Use
Check whether an object is a specified type or a subtype oclIsKindOf
Get the direct parent types of a class superTypes
Get all parent types in the inheritance hierarchy allSuperTypes

See also