File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Proxy for a Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Proxy for a Class" Watch "Proxy for a Class" New topic

Proxy for a Class

D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Is any way to create a Proxy object for a Class? I tried, but it told only interface can be used. Why so restriction?

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Just because. They could have designed proxies so they could be subclasses of a given class, I suppose, but that wouldn't always work; and especially for classes with no default constructors, or final classes, etc; in fact, the rules might get rather complex. Only doing this for interfaces is much easier to understand!

[Jess in Action][AskingGoodQuestions]
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Thanks, it sounds reasonable. SO I'll cope with hte limitation.
I agree. Here's the link:
subject: Proxy for a Class
It's not a secret anymore!