OCLOperators oclIsTypeOf
Created by Alexandra on 2017-08-13 · Last edited by Colline.ssali on 2026-02-26.
oclIsTypeOf( typespec : Class ) : Boolean
The oclIsType(T) operator checks whether an object is of a given type or any of its subtypes. It is mainly used in models with inheritance to safely test an object’s runtime type.
| Expression | Result |
|---|---|
| anEmployee.oclIsTypeOf(Employee) | true |
| anEmployee.oclIsTypeOf(Person) | false |
| aCat.oclIsTypeOf(Person) | false |
Too check if an Object inherits from another type use OCLOperators oclIsKindOf
