🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators allStates
Created by Lars.olofsson on 2017-08-13 · Last edited by Colline.ssali on 2025-12-29.


The allStates operator is a state-machine–related OCL operation that returns all states defined for a class, including both simple and composite states. It is mainly used for model introspection, allowing you to query and work with the lifecycle or state machine associated with a class rather than its attribute data.

Returns names of all states in all state machines for this type.


Return Type

Collection(String)


Example:

Assume the Department class has a lifecycle (state machine) with the following states:

  • Draft
  • Active
  • Suspended
  • Closed
Department.allStates

Results:

A collection containing:

Draft, Active, Suspended, Closed