• 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: Class.this.. ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class.this.. ?


  • Subject: Re: Class.this.. ?
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Sat, 20 Sep 2008 17:46:57 -0400


On Sep 20, 2008, at 16:36, Ash Mishra wrote:

I understand what it's doing (i.e. accessing the woDisplayGroup and setting a value in it) but I've not seen the MyListPage.this. reference before, where the class name is followed by 'this' and than a variable of the class.

Is this some special Java reference?

If I understand you well, you are asking about the syntactical implication of this construction:


"ClassName.this"

This type of referencing is used in inner classes to obtain the instance of the nesting class. In the example you used, it will ensure that you get a reference to the MyListPage instance, and not to the instance of the anonymous class that extends NextPageDelegate (declared in line 9).

While in the piece of code you refer to it is not necessary to do this, since referencing "myDisplayGroup" can be done directly, it would be necessary if the anonymous NextPageDelegate subclass also had a "myDisplayGroup" variable. In that sense I wouldn't say it's wrong, but just over-cautious.

F

try googling "Java inner class tutorial"
_______________________________________________
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


  • Follow-Ups:
    • Re: Class.this.. ?
      • From: Ash Mishra <email@hidden>
References: 
 >Class.this.. ? (From: Ash Mishra <email@hidden>)

  • Prev by Date: Re: Class.this.. ?
  • Next by Date: Re: Class.this.. ?
  • Previous by thread: Re: Class.this.. ?
  • Next by thread: Re: Class.this.. ?
  • Index(es):
    • Date
    • Thread