KeyValueCoding
KVC resolves a binding like $name to a method or field on the component.
Reading
First match wins. Public members only.
getName()name()isName()_getName()_name()_isName()- field
name - field
_name - field
_isName - field
isName
No match throws UnknownKeyException, with a suggestion: "Did you mean 'name'?". In a template, it shows as an error box in the page.
Setting
Forms set bindings on submit.
setName( value )- field
name
Strings are converted when the target is a number.
Keypaths
$company.manager.name resolves each key on the result of the previous one.
A null anywhere makes the whole keypath null, with no NullPointerException. Setting through a null fails.
Maps and custom lookups
Maps aren't supported: $map.key doesn't read the map's entry (#36). To customise lookups, implement NGKeyValueCoding (valueForKey, takeValueForKey).
From Java
Object name = NGKeyValueCoding.Utility.valueForKey( user, "name" );
NGKeyValueCoding.Utility.takeValueForKey( user, "Jane", "name" );
Lookups are cached per class and key in production, but not in development.