When the value is valid, validateValueForKey simply returns. But if it encounters an error, it raises the exception Validation.ValidationException. This exception holds a dictionary gathering the reasons of failure; this dictionary has the following characteristics:
For example, suppose we called aWriter.validateValueForKey('',
'lastName')
and that attribute lastName is marked as 'required',
the raised exception's dictionary is then::
{'lastName': ['Key is required but value is void',], }
If validateValueForKey raises an exception, the dictionary will only contain one key: the one that was supplied as the parameter 'key'. Its corresponding value is a list of all observed errors; here, it corresponds to the constant Validation.REQUIRED defined in the Validation interface. You will find there the complete list of possible error codes.
Comments are welcome: Sebastien Bigaret / Modeling Home Page