Navigation:  Programming Cookbook > Binary Filing Objects > Customising storage >

Overriding a proxy

Previous pageReturn to chapter overviewNext page

It is sometimes desirable to override the whole proxy mechanism for particular instances on a per output session basis. For instance, You may have a hierarchy of objects and you want to output from a certain point down, i.e. treating the crucial parent reference as nil. You can, of course, change the object before the filing process commences and then change it back again afterwards, or perhaps get #stbSaveOn: to file out different instances of the same class in different ways, but these techniques may prove inconvenient.

You can achieve a temporary proxy override using STBOutFiler>>#override:with:. Before filing out the object that needs special attention (or any references to it) you:

...

outFiler #override: theObject with: thisProxy.

...

 

where thisProxy is similar in concept to the as: parameter of STBOutFiler>>#saveObject:as:,

i.e.

0 means output the object with no proxy
nil means output nil instead of the object
some instance of an STBProxy means output that instead of the object.