OCLOperators oclIsKindOf
(Replacing message template with parser tag)
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
=== <message>Write the content here to display this box</message>oclIsKindOf( typespec : Class ) : Boolean ===
=== oclIsKindOf( typespec : Class ) : Boolean ===
Returns true if the type of ''self'' corresponds to the type or supertype of typespec - otherwise, returns false. This operation allows users to check the class hierarchy of ''self'' much like they would an instance of Java.
Returns true if the type of ''self'' corresponds to the type or supertype of typespec - otherwise, returns false. This operation allows users to check the class hierarchy of ''self'' much like they would an instance of Java.
{| class="wikitable"
{| class="wikitable"
Line 15: Line 14:
|false
|false
|}
|}
To check if an object has the exact type and not only inherits a type use [[OCLOperators oclIsTypeOf]]
To check if an object has the exact type and not only inherits a type use [[Documentation:OCLOperators oclIsTypeOf|OCLOperators oclIsTypeOf]]
[[Category:OCL General Operators]]
[[Category:OCL General Operators]]
{{Edited|July|12|2024}}
{{Edited|July|12|2025}}

Latest revision as of 05:24, 12 February 2025

This page was created by Alexandra on 2017-08-13. Last edited by Stephanie@mdriven.net on 2025-02-12.

oclIsKindOf( typespec : Class ) : Boolean

Returns true if the type of self corresponds to the type or supertype of typespec - otherwise, returns false. This operation allows users to check the class hierarchy of self much like they would an instance of Java.

Expression Result
anEmployee.oclIsKindOf(Employee) true
anEmployee.oclIsKindOf(Person) true
aCat.oclIsKindOf(Person) false

To check if an object has the exact type and not only inherits a type use OCLOperators oclIsTypeOf