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, 7 Jan 2008 10:36:17 -0500
public T valueForKey(Key<T> key) {
return valueForKey(key.key);
}
Well sure, if you totally change the API for valueForKey, but you're
cheating on the original question ;) You would want a <T> in there,
too, for the per-method generic.
NSArray<MyEO> = ec.objectsWithFetchSpecification(spec, MyEO.class)
I think generic EOFS would be better ... Passing in Class objects to
fulfill generics always feels a bit like hackery. It's really cheating
-- you're basically casting without using cast syntax, because you
can't enforce that the class you put in is actually related to the
objects of the fetch spec in any way, so it's as unsafe as an
arbitrary cast.
public <T> NSArray<T>
objectsWithFetchSpecification(EOFetchSpecification<T> fetchSpec) { ... }
then
EOFetchSpecification<Person> fetchSpec = ...;
NSArray<Person> people = ec.objectsWithFetchSpecification(fetchSpec);
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