Re: FetchSpec seems to ignore qualifier
Re: FetchSpec seems to ignore qualifier
- Subject: Re: FetchSpec seems to ignore qualifier
- From: David Griffith <email@hidden>
- Date: Thu, 04 Mar 2004 14:04:06 +0100
Thanks for the hints Art,
No, the compiler does not complain about the statement. I have taken the
code directly from the EOModeler guide (which incidentally was not
completely correct in its sequence of statements). However, as I understand
it, if a method is static, it does not preclude an instance from using it.
An instance should be able to call a static method (since it too might need
the functionality). I'm sure it's fine to call it either way below.
With regard to condensing statements, I realise that sometimes I can do that
and don't, mostly it's for pure readability for others that may be using the
code (as they learn).
Also, I haven't really used EOUtilities, so it's interesting to know that
the method you have used below exists....
Regards,
Dave.
> On Mar 3, 2004, at 1:23 PM, David Griffith wrote:
>
>> EOFetchSpecification fs = new EOFetchSpecification();
>> fs = fs.fetchSpecificationNamed("getLanguageFromString",
>> "Language");
>
> Does the compiler not complain about the above statement? The WO
> 5.2.2 docs state that EOFetchSpecification's fetchSpecificationNamed()
> method is a static, not an instance method. So the above two
> statements should be:
>
> EOFetchSpecification fs =
> EOFetchSpecification.fetchSpecificationNamed("getLanguageFromString",
> "Language");
>
>> NSMutableDictionary dictionary = new NSMutableDictionary();
>> dictionary.takeValueForKey(languageName, "langName");
>> fs = fs.fetchSpecificationWithQualifierBindings(dictionary);
>>
>> NSMutableArray languages= new
>> NSMutableArray(ec.objectsWithFetchSpecification(fs));
>
> I don't see anything obviously wrong with the above statements, but
> they can be condensed to the following:
>
> NSDictionary dictionary = new NSDictionary(languageName, "langName");
> NSMutableArray languages = new
> NSMutableArray(EOUtilities.objectsWithFetchSpecificationAndBindings(ec,
> "Language", "getLanguageFromString", dictionary));
>
> Aloha,
> Art
> _______________________________________________
> 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.
_______________________________________________
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.