Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Forcing local scoping

Thread view: 
Joe Seigh - 04 Feb 2007 21:30 GMT
Is there any way of forcing local scoping that's a little cleaner
than using an anonymous inner class?  I need to be able to enforce
some before entering block and after entering block actions.
Anonymous inner classes seem a little kludgy.

Signature

Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.

Tom Hawtin - 04 Feb 2007 21:42 GMT
> Is there any way of forcing local scoping that's a little cleaner
> than using an anonymous inner class?  I need to be able to enforce
> some before entering block and after entering block actions.
> Anonymous inner classes seem a little kludgy.

I don't think they are a kludge (well other than the implementation into
the class file format). It's just the syntax is highly verbose for a
simple ExecuteAround.

You could generate a proxy for appropriately annotated methods, but that
would be even more of a kludge.

Tom Hawtin
Joe Seigh - 05 Feb 2007 11:01 GMT
>> Is there any way of forcing local scoping that's a little cleaner
>> than using an anonymous inner class?  I need to be able to enforce
[quoted text clipped - 7 lines]
> You could generate a proxy for appropriately annotated methods, but that
> would be even more of a kludge.

Plus it's not really a block but a method call so you lose local variable
scoping.  Ah well, I'll probably just go with requiring the user to use
enter and exit block actions  in a try/finally block.  Thanks anyway.

Signature

Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.