Custom validator that takes a function

I needed this feature because the validation criteria changed with each instance of the object.