Re: Is it safe to use NSDictionary as the objects in a (WO/ERX)DisplayGroup?
Re: Is it safe to use NSDictionary as the objects in a (WO/ERX)DisplayGroup?
- Subject: Re: Is it safe to use NSDictionary as the objects in a (WO/ERX)DisplayGroup?
- From: Chuck Hill <email@hidden>
- Date: Tue, 09 Apr 2013 17:57:53 -0700
On 2013-04-09, at 5:10 PM, Paul Hoadley wrote:
> Hello,
>
> I needed to display the content of an array of NSDictionary objects, and without thinking I just loaded them into an ERXDisplayGroup via an EOArrayDataSource:
>
> EODataSource ds = new EOArrayDataSource(EOClassDescription
> .classDescriptionForClass(NSDictionary.class), editingContext());
That is just not going to end happily. EODataSource is for EnterpriseObjects. NSDictionary != EOEnterpriseObject
> Two observations followed:
>
> 1. This works. I guess that pretty much answers my question, but are there any undesirable side-effects?
Any hair growing from your palms? What about now? Now?
> (I probably shouldn't be specifying the component's EOEditingContext up there. I should change that to ERXEC.newEditingContext().)
That is going to be the least of your problems.
> 2. Not surprisingly the code throws an exception at runtime:
>
> ERROR ERXEntityClassDescription - Unable to register descriptions for class: com.webobjects.foundation.NSDictionary
> java.lang.RuntimeException: Dummy
>
> Can I safely catch and/or ignore that?
Safely? You are on the other side of the planet, so it should be safe. For me. Not only is it looking for a class description, it is looking specifically for an entity one. As in what is usually derived from the EOModel.
> In short, I'd like to use all the nice ERXDisplayGroup machinery, but the objects are NSDictionaries. Am I likely to regret this in the future?
Maybe even today.
Chuck
--
Chuck Hill
Executive Managing Partner, VP Development and Technical Services
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden