Version: v0.8.1 - Beta.  We welcome contributors & feedback.

ObjectHooks.onEquals

onEquals($otherObject) -> boolean

Description

Override the result of calls to equals().

Should return true or false.

class MyObject {

    public fields {
        id: 0
    }

    public fun onEquals($otherObject) {

        return @.id == $otherObject.id
    }
}

$obj1 = MyObj({ id: 123 })
$obj2 = MyObj({ id: 123 })
$obj3 = MyObj({ id: 999 })

$obj1.equals($obj2)  //= true
$obj1.equals($obj3)  //= false

See Also