link = mapping.createPBinding()where mapping is the class mapping associated with the object's class. Two cases may occur.
the_name = link.export(connection, hints)where connection is a reference to the data store, and hints contains optional additional preferences. The operation creates and returns a new PName, which designates the new DSI. Note that the DSI is not initialized; this has to be explicitly done by a link.write() operation.
link.bind(the_name)which causes the binder to create the association between the binding and the name of the persistent object.
ref_name = get_field_id() (1) local_name = NC(field_id).export(ref_name) (2) save(NC(field_id).encode(local_name)) (3)In (1), the reference is read, using the specific "getter" for field_id. In (2), the reference (a PName) is exported to the local context associated with the field (these contexts are maintained by the class mapping). In (3), the name is encoded, using the local encoding conventions, and written to persistent storage. In effect, this sequence of operations performs swizzling. This method is general and applies to any form of naming through a chain of naming contexts.
local_name = NC(field_id).decode(read_stored_name) (1') ref_name = NC(field_id).resolve(local_name) (2') set_field_id(ref_name) (3')In (1'), the stored reference is decoded in the local context. In (2'), the name is resolved, possibly traversing a context chain, up to its original context. In (3'), the name is written to the MI, using the adequate "setter" method.