Pattern matching object validation