Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6081485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:10:51+00:00 2026-05-23T11:10:51+00:00

For some custom client-server-communication code in GWT, I’d like to dynamically implement a Java

  • 0

For some custom client-server-communication code in GWT, I’d like to dynamically implement a Java interface similar to the way it would be done with java.lang.reflect.Proxy. Since GWT doesn’t include any reflection support and I am loathe to write a clunky Code Generator, I’m wondering if this could be done with JSNI and Overlay types.

I’m thinking along the following lines:

  1. I have some existing java interface, and somehow a representation of its methods and their signatures, annotations, etc. (since the actual class object won’t be of any help in GWT).
  2. I pass that representation into some JSNI method that uses it to construct a new Javascript object and define corresponding methods on it. The actual implementation of the methods is fairly trivial, they just write their arguments into some datastructure and return null.
  3. I get a Javascript object back from JSNI that is somehow castable to the interface type. When methods from the interface are invoked on this instance, the corresponding Javascript method that was defined in step 2 gets invoked and saves the arguments.

Has anybody attempted something similar? Are there reasons why this won’t work on principle?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:10:52+00:00Added an answer on May 23, 2026 at 11:10 am

    What prevents you from doing the same thing in Java? Have a factory method that you pass some data to, and it returns an implementation of your interface. Since you say implementation is pretty trivial you would have a limited set of concrete classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a client/server app that will communicate via rest. Some custom request data
Is there a way to run some custom Javascript whenever a client-side ASP.NET validator
I need to implement a WatchList class as a part of a Java client-server
I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs).
I have developed some custom DAO-like classes to meet some very specialized requirements for
We have a custom built program that needs authenticated/encrypted communication between a client and
I have a WCF Service which returns some custom objects to a desktop client
hey guys, here's a simple scenario NServiceBus Client/Server setup. The Message is a custom
i have a client & server application which communicate using WCF. To add some
I'm developing custom client/server application that requires client to log in with their username

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.