Re: what to do with java.lang.reflect.Proxy ???

From: Larry A. Barowski (larrybar_at_eng.auburnANOTHERDOTedu)
Date: 12/04/03


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



Relevant Pages

  • Re: Which JVM to use under Windows?
    ... be coded to support 1.4, ... Home users have no reason to stay at an old version of Java. ... They just locked their horns with Microsoft and use ...
    (comp.lang.java.programmer)
  • Re: porting from C++Builder
    ... and I do believe that standard support of PME ... the java was growing and, obviously, microsoft initially tried to ...
    (microsoft.public.dotnet.languages.vc)
  • Re: C to Java Byte Code
    ... >So you don't support longs as that term is understood (in contemporary ... But char on Java is actually 2 bytes, ... >many C programs that share or access memory directly will fail. ... MPC speed compared to native C code speed. ...
    (comp.programming)
  • RE: Soap class definition question
    ... Yes, for the "standard webservce" proxy, it hasn't provided support on ... still us the standard webservice "add WebReference" to generate ... webservice client proxy. ...
    (microsoft.public.dotnet.xml)
  • RE: Soap class definition question
    ... Yes, for the "standard webservce" proxy, it hasn't provided support on ... reusing typeslike what WCF ... its autogenerated one to your shared common types. ...
    (microsoft.public.dotnet.xml)