Re: Class.this.. ?
Re: Class.this.. ?
- Subject: Re: Class.this.. ?
- From: Florijan Stamenkovic <email@hidden>
- Date: Mon, 22 Sep 2008 09:36:21 -0400
Oh, sorry, I missed that... In that line it is necessary.
F
On Sep 20, 2008, at 17:50, Ash Mishra wrote:
Thanks Florijan.
would it not be needed in the Delegate's last line:
return MyListPage.this;
?
On 20-Sep-08, at 2:46 PM, Florijan Stamenkovic wrote:
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.
_______________________________________________
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