Re: Class.this.. ?
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