Re: WO5.4: Generics for objectsWithFetchSpecification ???
Re: WO5.4: Generics for objectsWithFetchSpecification ???
- Subject: Re: WO5.4: Generics for objectsWithFetchSpecification ???
- From: Mike Schrag <email@hidden>
- Date: Mon, 14 Jan 2008 10:30:09 -0500
Couldn't you handle both raw rows and EOs by using the type
NSArray<NSKeyValueCodingAdditions>?
You might as well return "Object" and not use generics if you do this,
though ... The point is that you WANT a more specific EO class.
I think Lachlan's basic concept is the clearest so far (if this
feature goes in at all):
@deprecated
public NSArray objectsWithFetchSpecification(EOFetchSpecification
fetchSpec) {...}
public NSArray<T> enterpriseObjectsWithFetchSpecification
(EOFetchSpecification<T> fetchSpec) {...}
this should be:
public <T extends EOEnterpriseObject> NSArray<T>
eosWithFetchSpecification(EOFetchSpecification<T> ..)
public NSArray<NSDictionary<String, ?>>
rawObjectsWithFetchSpecification(EOFetchSpecification fetchSpec)
{....}
... and this really isn't a ? type (which would imply that all the
values are the same type, you just don't know what it is) .. I think
it should just be:
public <T extends EOEnterpriseObject> NSArray<NSDictionary<String,
Object>> rawRowsWithFetchSpecification(EOFetchSpecification<T>
fetchSpec ...)
I put the T here because then you can always declare the proper type
of the fetch spec, but depending on whether you call eosWith or
rawRowsWith, it will give you back the right thing. One question is
whether these throw IllegalArgumentException if the fetch spec claims
to want raw rows and you use the wrong method, or whether the method
should override the setting in the fetch spec.
ms
_______________________________________________
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