you to return any
subclass of MPVLoginPage.
Bill
From: Ricardo J. Parada [mailto:rpar...@mac.com]
To: WebObjects-Dev Apple [mailto:webobjects-...@lists.apple.com]
Sent: Thu, 28 May 2009 17:00:06 -0600
Subject: Generics question
I'm changing my code to use pageWithName(Foo.class) instead
On 16/05/2009, at 12:07 PM, Mike Schrag wrote:
I'm not sure this is really any better ... Fundamentally there's a ?
in that param, and as a result, it's impossible to do a put in a
typesafe way. You don't know what V is. I _think_ the signature as
it is now is actually correct, but if
you should clone it to a concrete mutable type if you wish to modify
it.
have fun with this btw ... the cherry on top is that you can't even
reliably CLONE these stupid things, because 1) cloning in java is
retarded and 2) even if you can clone, you might just be cloning an
immutable map
Hi Andrew,
I find it odd that the map should have ? extends ListString as a
parameter as the extension ought to be unnecessary (assuming callers
are working to the List interface) - any List implementation with a
String parameter fulfills ListString. I like generics too, but have
come
Hello Jim;
Thanks for the reply.
what the calling method ought to be doing though is declaring the
list it passes as MapString, ListString and hiding the concrete
List implementation, negating the need for the wildcard.
I tried it with a concrete implementation of List as well, but this
Yeah this is a tricky one ... But you're right that the API is ?
extends ListString so you can pass in NSArrayString, which is a
pretty common implementation. You also can't necessarily just assume
people can declare their vars as ListString instead of
NSArrayString because you don't know
Hi Andrew,
what the calling method ought to be doing though is declaring the
list it passes as MapString, ListString and hiding the concrete
List implementation, negating the need for the wildcard.
I tried it with a concrete implementation of List as well, but this
also raised an error
well, no matter what you do, i think you're going to throw out type
safety, so inside the method, you could just cast the headers to
String, ListString :
MapString, ListString badCast = (MapString,
ListString)headers;
badCast.put(a, new LinkedListString());
ms
On May 15, 2009,
On 15/05/2009, at 10:48 PM, Mike Schrag wrote:
Yeah this is a tricky one ... But you're right that the API is ?
extends ListString so you can pass in NSArrayString, which is a
pretty common implementation. You also can't necessarily just
assume people can declare their vars as ListString
public WORequest createRequest( String method,
String aurl,
String anHttpVersion,
Map String, ? extends List String
someHeaders,
NSData content,
Map String, List String correctHeaders = new HashMap String,
List String ();
btw, this is what i was saying that the only typesafe way to do this
is to copy the original headers -- so you would do new HashMapString,
ListString(originalHeaders) and then you'd have a properly typesafe
On 16/05/2009, at 9:27 AM, Mike Schrag wrote:
public WORequest createRequest( String method,
String aurl,
String anHttpVersion,
Map String, ? extends List String
someHeaders,
On May 15, 2009, at 4:59 PM, Lachlan Deck wrote:
Generics are great mostly - but there are times when it's just
downright annoying :-).
Sounds like Maven!
:-P
--
Chuck Hill Senior Consultant / VP Development
Come to WOWODC'09 in San Fran this June!
On 16/05/2009, at 10:03 AM, Chuck Hill wrote:
On May 15, 2009, at 4:59 PM, Lachlan Deck wrote:
Generics are great mostly - but there are times when it's just
downright annoying :-).
Sounds like Maven!
:-P
Touché ;-)
But still lovin' your work as the unlikely ambassador, finding every
Hi Mike,
The following solution doesn't solve the unchecked type cast problem.
But it respect PECS definition and accept a MapString,
NSArrayString as parameter. Do you think it is reasonable?
public V extends ListString WORequest treateRequest(String
method, String url, String
I'm not sure this is really any better ... Fundamentally there's a ?
in that param, and as a result, it's impossible to do a put in a
typesafe way. You don't know what V is. I _think_ the signature as it
is now is actually correct, but if you need to insert into that map
inside
Am 16.05.2009 um 01:29 schrieb Mike Schrag:
Map String, List String correctHeaders = new HashMap String,
List String ();
btw, this is what i was saying that the only typesafe way to do this
is to copy the original headers -- so you would do new
HashMapString,
I've been working with generics for quite a while (and quite like
them) but this one has me stumped!
public WORequest createRequest(String method,String url,String
anHTTPVersion,MapString,? extends ListString someHeaders,NSData
content,MapString,Object someInfo)
{
...
Sorry wrong method; I obviously meant put rather than add in this
example and The method put(String,ListString) in the type
MapString,capture#1-of? extends ListString is not applicable for
the arguments (String,ListString) is the problem.
I've been working with generics for quite a while
Hi,
Will someone please help me here? How do I do the following without
getting the pesky warning from Eclipse about unchecked type conversion?
NSArrayNewsKeywords newsKeywords =
EOUtilities
.objectsForEntityNamed
(EOSharedEditingContext.defaultSharedEditingContext(), NewsKeywords);
On Dec 20, 2007, at 2:03 PM, Jonathan Miller wrote:
How do I do the following without getting the pesky warning from
Eclipse about unchecked type conversion?
NSArrayNewsKeywords newsKeywords =
EOUtilities
.objectsForEntityNamed
(EOSharedEditingContext.defaultSharedEditingContext(),
21 matches
Mail list logo