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

The ClassFromString operator allows you to treat a string as a model type (OclType). When "going meta" with your model, you can use AsString to convert a type to a string, and ClassFromString to perform the inverse operation—converting that string back into an actionable type.

This is particularly useful when you need to query model metadata or filter subclasses based on naming conventions or tagged values stored as strings.

Syntax

string.ClassFromString

Example

Customer.allSubClasses->select(x|x.classfromstring.TaggedValue('status')<>'Obsolete')

This returns a collection of class strings where the actual underlying class does not have the "Obsolete" tag.

Documentation:ClassFromString