Re: what to do with java.lang.reflect.Proxy ???
From: Larry A. Barowski (larrybar_at_eng.auburnANOTHERDOTedu)
Date: 12/04/03
- Next message: Jaume: "Re: Bar codes / UPC Question/Help"
- Previous message: John C. Bollinger: "Re: how to pass this before supertype constructor has been called"
- Maybe in reply to: Dale King: "Re: what to do with java.lang.reflect.Proxy ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 04 Dec 2003 15:41:46 -0600
snatchitup wrote:
> I have 'foo'led around with java.lang.reflect.Proxy, additionally,
> have done plenty with Cass.getClasses() and invocation. I'm in the
> J2EE world, and WebServices.
>
> Basically, I haven't come up with an "Original Thought" on how to use
> this to make my job of writing applications easier. I want it to do
> my work for me.
>
> I've learned in the past that the lesser used portions of a language
> that implement some sort of indirection is where the hidden gems are;
> that can lead to productivity enhancements by building tools such as
> code generators.
>
> I've used getClasses(), getMethods(), and invoke() to do some
> automating the process of generating data objects from beans.
>
> Is there something I'm missing on the usefulness of Proxy to an
> application developer. I'm not looking to write a "logging" tool.
>
> The main drawback I see with Proxy, is that I should re-engineer alot
> of the code to make more extensive use of interfaces.
One thing missed in the previous replies: Proxys are great for
using
functionality that is not available on all targets. For example, a Proxy
implementing MouseWheelListener can be used to support the
mouse wheel on Java 1.4, for code that must also run on Java 1.3.
And any serious Java application should at least support an
MRJQuitHandler so the application menu "Quit" item will work under
Mac OS X (the default behavior is just to kill the application).
You can do the same thing using stubs, but you never know when
a JVM is going to try to load an "usused" class. I've seen stubs that
work fine on one target fail on another - I'm not sure why, maybe
the unused classes are needed by the JIT compiler.
-Larry Barowski
- Next message: Jaume: "Re: Bar codes / UPC Question/Help"
- Previous message: John C. Bollinger: "Re: how to pass this before supertype constructor has been called"
- Maybe in reply to: Dale King: "Re: what to do with java.lang.reflect.Proxy ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|