Would doing an instance of check here be of use? We've had problems in the past when people use the wrong classes in the wrong places. Using `instanceof` would help enforce the API contract.