We have seen how to map any attribute's value to an instance of given class. Here again, this is the KeyValueCoding in action, as described in section 8.2.
The framework always accesses the attributes' values with the so-called "private" methods (storedValueForKey(), takeStoredValueForKey()). We already know that they will try to use private setters/getters -such as _setPrice() and _getPrice()- before the public ones -being getPrice() and setPrice()).
So, what happens here is:
Note: the same happens for validation before saving: type checking also calls _getPrice() and gets a string, so everything's ok.
price
, this method finds and calls
_setPrice() which turns the string back to
FixedPoint.
Comments are welcome: Sebastien Bigaret / Modeling Home Page