> 
> On 25/05/2015, at 05:37, Johann Werner <j...@oyosys.com> wrote:
> 
> Hi Mark,
> 
> NSKeyValueCoding.DefaultImplementation is a static class which renders it 
> quite difficult to modify or replace some functionality. One way to do so 
> would be to reimplement the class with your modifications and put that prior 
> to the original class on your build path so that it is loaded before the 
> original one. This procedure is used at some places in Wonder code already.
> 
> Another, less drastic, way would be to create a subclass of Optional. That 
> ERXOptional could then implement NSKeyValueCoding to fire up a key path on 
> its internal value (or null) instead of itself. That would fix 
> valueForKey(Path) on chains where ERXOptional objects are included. Of course 
> this doesn’t work where you have no control on what optional class is 
> used/returned.

Unfortunately, Optional is final and cannot be extended. :(

Cheers,

Henrique

> 
> jw
> 
> 
>> Am 23.05.2015 um 23:24 schrieb Mark Wardle <m...@wardle.org>:
>> 
>> Dear all,
>> 
>> I’ve migrated to java 8 in development and deployment and am now dabbling 
>> with new “features”.
>> 
>> Optionals seem a potentially good way of documenting nullability although 
>> the syntax is currently rather cumbersome it seems likely that in future 
>> versions, the syntax will improve.
>> 
>> However, key value coding fails when an object is encapsulated by an 
>> Optional. Intuitively, these should be unwrapped during KVC so that “normal” 
>> behaviour continues - i.e. as KVC gracefully handles null pointers in 
>> arbitrary key paths it should gracefully handle optionals containing either 
>> a value or null.
>> 
>> How would the handling of KVC be patched for future java versions? Is this 
>> something fixable now? Does all KVC work via 
>> NSKeyValueCoding.DefaultImplementation or are there multiple 
>> implementations? I used to have a java decompiler working but haven’t set 
>> this up since upgrading eclipse so it has been difficult to fathom the 
>> internals.
>> 
>> Mark
>> 
>> --
>> Dr. Mark Wardle
>> Consultant Neurologist, University Hospital Wales, Cardiff, UK
>> Deputy Sub-Dean for Assessments and Honorary Lecturer, Cardiff University
>> Email: mark.war...@wales.nhs.uk or m...@wardle.org  Twitter: @mwardle
>> Telephone: 02920745274 (secretary) or facsimile: 02920744166
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/hprange%40gmail.com
> 
> This email sent to hpra...@gmail.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to