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 6128715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:39:30+00:00 2026-05-23T16:39:30+00:00

Starting with one Java base-interface, I want others to be able to extend this

  • 0

Starting with one Java base-interface, I want others to be able to extend this interface, directly or indirectly, and add bean properties and behavior to it, as a plugin system.

Then, at runtime, on the user computer, I would find all those interfaces and generate a single big class that implements them all. The fields required for the bean properties would be generated automatically, while the behavior defined in the interfaces would be implemented as static methods of an helper class (created by the plugin developers) that take the appropriate interface as first parameter, so the implementation of the interface method would delegate to a static method, passing “this” as first parameter.

This is similar to how Scala implements it’s traits.

I see 3 ways of doing this:

  1. Use Java’s dynamic proxies, which are based on reflection.
  2. Generate the source-code as a string, and compile it at runtime.
  3. Use some bytecode manipulation library to generate the class at runtime.

Option 1 is the easiest, but least efficient, and therefore I want a better solution. Option 2 would give me an efficient implementation, but is rather ugly.

While I have seen several libraries that can do option 3, they all seem to require that I learn Java’s assembler language first, which I take as a very time-consuming activity, with little benefits in the end..

Since I don’t want to learn any assembler, JVM or otherwise, is option 2 my best bet, or are there libraries that can generate dynamic proxies without me using JVM assembler?

  • 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-23T16:39:30+00:00Added an answer on May 23, 2026 at 4:39 pm

    Have a look at Javassist. With it, you can make runtime changes to classes using a straight-forward API. You don’t need to know about java “black magic” to use it.

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

Sidebar

Related Questions

Probably a really simple one this - I'm starting out with C# and need
This is a fundamental question, but an important one none the less... When starting
I'm starting to create a Industrial Simulation (IS) interface, using Java. The problem I'm
Starting a new project and would like to use one of the MVC framworks.
I'm just starting with Mercurial and one of the things that I should do
I am just starting to use Subversion with Tortoise SVN client for one of
I am starting out with automated testing and I would like to test one
I am starting to develop an Eclipse plugin (technically, an OSGi plugin) and one
Starting with 2005, VS started this behavior of when starting debugging session it spawns
Starting with the error: Error 81 The OutputPath property is not set for this

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.