• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSelector<T> - a curiosity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSelector<T> - a curiosity


  • Subject: Re: NSSelector<T> - a curiosity
  • From: Galen Rhodes <email@hidden>
  • Date: Thu, 8 May 2008 10:22:31 -0400

Well, yea, you can "look for" methods with a Void return type. You can use Class.getMethods() and then use the Method.getReturnType() on each method returned to find them. Also, as of 1.5 you can get the generic return type too.

--
Galen Rhodes
email@hidden
http://www.photoyoda.com
http://www.myspace.com/woexpert




On May 8, 2008, at 10:07 AM, Florijan Stamenkovic wrote:

Don't know about the "looking up" part... AFAIK return types are not a part of the method signature in Java, also indicated by Class API, whose "getMethod..." stuff does not ask for the return type as a parameter...

Think that Void class it has more to do with the Metod class' getReturnType() method...

Or am I missing something?

F

On May 08, 2008, at 07:12, Galen Rhodes wrote:

The "Void" class came into being to support Reflection. So that you could look for methods whose return type was "void".

--
Galen Rhodes
email@hidden
http://www.photoyoda.com
http://www.myspace.com/woexpert




On May 7, 2008, at 10:07 PM, Chuck Hill wrote:


On May 7, 2008, at 7:01 PM, Michael Scott wrote:

Thanks Stephanie and Mike.

NSSelector<Void> works fine, and it makes the code clearer.

Any idea while the language has this Void class? Something to do with void/null/”” Strings?

The JavaDocs say "The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void." It has been there since 1.1, so it has been needed before.



Chuck



On 8/5/08 2:55 AM, "Mike Schrag" <email@hidden> wrote:

This compiles, at least ... Good to know.

NSDictionary<String, Void> a = new NSMutableDictionary<String, Void>();

ms

On May 7, 2008, at 1:37 PM, Stephane Guyot wrote:

Michael,

did you try the type Class Void ? something like Void.Type ?

HTH,
Stephane


Le 7 mai 08 à 09:35, Michael Scott a écrit :

NSSelector<Object> works fine.  But it is a bit wonky.

Perhaps Java should allow 'null' as a type argument.

Probably a bit much to ask just to make an old NextStep class more
consistent.



On 7/5/08 2:11 PM, "Anjo Krank" <email@hidden> wrote:

Try to cheat an use <Object>?

Am 07.05.2008 um 04:12 schrieb Michael Scott:

NSSelector has been generified (generifried?) so that the return
type of the method it calls must be specified as a type parameter.


So,
  NSSelector<String> selector = new
NSSelector<String>(“testMethod”);

Can be used to call the following method which returns a String
(regardless on what class the method resides):


  public String testMethod() {
      return “testing, testing, 1, 2, 3 ...”;
  }

But what if the method returns void?

  public void testMethod2() {
      // do something fab
  }

What type argument should be used to instantiate NSSelector<T>?

Or have I missed something fundamental?

Cheers
Michael Scott



_______________________________________________
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


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects- email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


_______________________________________________
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


_______________________________________________
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

_______________________________________________ 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

--

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/products/practical_webobjects






_______________________________________________
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

_______________________________________________ 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


_______________________________________________ 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
References: 
 >Re: NSSelector<T> - a curiosity (From: Michael Scott <email@hidden>)
 >Re: NSSelector<T> - a curiosity (From: Chuck Hill <email@hidden>)
 >Re: NSSelector<T> - a curiosity (From: Galen Rhodes <email@hidden>)
 >Re: NSSelector<T> - a curiosity (From: Florijan Stamenkovic <email@hidden>)

  • Prev by Date: Re: NSSelector<T> - a curiosity
  • Next by Date: Re: Maybe it's too late
  • Previous by thread: Re: Whoops sorry...Re: NSSelector<T> - a curiosity
  • Next by thread: WO Tutorials
  • Index(es):
    • Date
    • Thread