Documentation Language: Swift

Function

oclIsKindOf(_:_:)

Checks if an object is of the specified type or a subtype.

func oclIsKindOf<T>(_ object: any EcoreValue, _ type: T.Type) throws -> EBoolean

Parameters

object

The object to check the type of

type

The type to check against (including subtypes)

Return Value

True if the object is of the specified type or a subtype

Discussion

Performs type hierarchy checking - returns true if the object is the specified type or any of its subtypes. This is more permissive than oclIsTypeOf.

Examples

let value: any EcoreValue = 42 as EInt
let result1 = try oclIsKindOf(value, EInt.self)    // Result: true
let result2 = try oclIsKindOf(value, Any.self)     // Result: true (subtype)
let result3 = try oclIsKindOf(value, EDouble.self) // Result: false