Skip to content

Context

Context declarations define the scope of OCL constraints.

ClassifierContextExpression

Defines invariants and definitions on a given type.

Signature

txt
context <Type> (inv|def)

Example

txt
context Person inv: self.age > 0

OperationContextExpression

Allows defining pre- and post-conditions on functions.

Signature

txt
context Person::kill() (pre|post)

Example

txt
context Person::setAge(age: number)
   pre: age > 0

PropertyContextExpression

Allows initializing or deriving a value for the targeted property.

Signature

txt
context Person::age (init|derive)

Released under the MIT License.