Re: Hiding NSKeyValueCoding$Null
Re: Hiding NSKeyValueCoding$Null
- Subject: Re: Hiding NSKeyValueCoding$Null
- From: John Boynton <email@hidden>
- Date: Tue, 09 Sep 2003 11:18:11 -0600
Hi Merul and list,
If there is a cleaner solution I'd like to hear about it, but I turn the
raw rows into a subclass of NSDictionary that translates returned
NSKeyValueCoding.Null values into null values:
NullTranslatingDict myDict = new NullTranslatingDict(rawRow);
Object possiblyNull = myDict.valueForKey("keyOfPossiblyNullObject");
NullTranslatingDict has, among other things:
private _realDict;
public NullTranslatingDict(NSDictionary realDict) {
_realDict = realDict;
}
public Object valueForKey(String key) {
Object result = _realDict.valueForKey(key);
if (NSKeyValueCoding.NullValue == result) {
result = null;
}
return result;
}
- John
Merul Patel wrote:
Hi,
I'm fetching a large data set using a raw row fetch since I don't need
to initially instantiate any EOs for the returned objects.
When I bind any key from a dictionary in the returned array to a
WOString, I'm getting an unsightly value for those fields that contain
null values: <com.webobjects.foundation.NSKeyValueCoding$Null>
If I change the fetch to return EOs then null fields are correctly
displayed, so is there a simple way to do the same for WOStrings bound
to NSDictionary keys?
Thanks,
Merul
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.