isKindOf

isKindOf(type: Type): Boolean;

The isKindOf method of the Any primitive type returns the Boolean value of true if the type of the Any variable is of the type specified by the type parameter. If the variable is a different type to that specified by the type parameter, the isKindOf method returns false.

The code fragment in the following example shows the use of the isKindOf method.

if not any.isKindOf(Object) then
    if any.isKindOf(Any) then
        return "not a valid reference";
    else
        return any.String;
    endif;
endif;

For example, any.isKindOf(Integer) returns true if the any variable contains an Integer, and any.isKindOf(Customer) returns true if the any variable contains a reference to an instance of the Customer class or one of its subclasses.

The following example shows the use of the isKindOf method.

vars
    date : Date;
begin
    date := fault.openDate;
    if fault.isKindOf(GenuineFault) then
        opFault.value := true;
    elseif ... then
       ...
    endif;
end;