🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators allStates


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 the 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