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

  • Home
  • SEARCH
  • 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 621171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:50:43+00:00 2026-05-13T18:50:43+00:00

We all know why Java does/should not have multiple inheritance. So this is not

  • 0

We all know why Java does/should not have multiple inheritance. So this is not questioning about what has already been debated till-cows-come-home.

This discusses what we would do when we wish to create a class that has the characteristics of two or more other classes.

Probably, most of us would do this to “inherit” from three classes. For simplicity, I left out the constructor.:

class Car
extends Vehicle
{
  final public Transport transport;
  final public Machine machine;
}

So that, Car class directly inherits methods and objects of Vehicle class, but would have to refer to transport and machine explicitly to refer to objects instantiated in Transport and Machine.

Car car = new Car();
car.drive(); // from Vehicle
car.transport.isAmphibious(); // from Transport
car.machine.getCO2Footprint(); // from Machine

I thought this was a good idea until when I encounter frameworks that require setter and getter methods. For example, the XML

<Car amphibious='false' footPrint='1000' model='Fordstatic999'/>

would look for the methods
setAmphibious(..), setFootPrint(..) and setModel(..). Therefore, I have to project the methods from Transport and Machine classes

class Car
extends Vehicle
{
  final public Transport transport;
  final public Machine machine;
  public void setAmphibious(boolean b){
    this.transport.setAmphibious(b);
  }
  public void setFootPrint(String fp){
    this.machine.setFootPrint(fp);
  }
}

This is OK, if there were just a few characteristics. Right now, I am trying to adapt all of SmartGWT into GWT UIBinder, especially those classes that are not a GWT widget. There are lots of characteristics to project.

Wouldn’t it be nice if there exists some form of annotation framework that is like this:

class Car
extends Vehicle
@projects {Transport @projects{Machine @projects Guzzler}}
{
  /* No need to explicitly instantiate Transport, Machine or Guzzler */
  ....
}

Where, in case of common names of characteristics exist, the characteristics of Machine would take precedence Guzzler’s, and Transport’s would have precedence over Machine’s, and Vehicle’s would have precedence over Transport’s. The annotation framework would then instantiate Transport, Machine and Guzzler as hidden members of Car and expand to break-out the protected/public characteristics, in the precedence dictated by the @project annotation sequence, into actual source code or into byte-code. Preferably into byte-code. So that the setFootPrint method is found in both Machine and Guzzler, only that of Machine’s would be projected.

Questions:

  1. Don’t you think this is a good idea to have such a framework?
  2. Does such a framework already exist? Tell me where/what.
  3. Is there an eclipse plugin that does it?
  4. Is there a proposal or plan anywhere that you know about such an annotation framework?

It would be wonderful too, if the annotation/plugin framework lets me specify that boolean, int, or whatever else needs to be converted from String and does the conversion/parsing for me too.

Please advise, somebody. I hope wording of my question was clear enough. Thx.

Edited:
To avoid OO enthusiasts jumping to conclusion, I have renamed the title of this question.

  • 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-13T18:50:44+00:00Added an answer on May 13, 2026 at 6:50 pm

    Perhaps not exactly what you are looking for, but you can take a look at Mixins:

    • the wikipedia article
    • Qi4j framework
    • CGLIB’s mixin support
    • this example
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 434k
  • Answers 434k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your exception "handling" will make sure that the insert succeeds,… May 15, 2026 at 3:23 pm
  • Editorial Team
    Editorial Team added an answer I did some searching and found some code (thanks to… May 15, 2026 at 3:23 pm
  • Editorial Team
    Editorial Team added an answer Neither MS-Paint or Photoshop allow vector graphic manipulation, however Inkscape… May 15, 2026 at 3:23 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.