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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:47:33+00:00 2026-05-11T03:47:33+00:00

I have a few classes such that: public class XMLStatusMessage extends XMLMessage {} public

  • 0

I have a few classes such that:

public class XMLStatusMessage extends XMLMessage {} public abstract class XMLMessage implements IMessage {}  public interface IMessageListener {     public void onMessage( IMessage message ); }  public interface XMLMessageListener <T extends XMLMessage> extends      IMessageListener {     public void onMessage( T message );  }  public interface XMLStatusMessageListener extends      XMLMessageListener <XMLStatusMessage> {     @Override     public void onMessage( XMLStatusMessage message ); } 

and

public class AStatusHandler implements XMLStatusMessageListener {     //...     @Override     public void onMessage( XMLStatusMessage message )     {         //...     } } 

My problem is that AStatusHandler won’t compile because I’m not also implementing public void onMessage(IMessage). I don’t see why I should have to implement onMessage(IMessage) also as it already implements onMessage(XMLStatusMessage) and XMLStatusMessage is an IMessage. Is there a simple solution to this problem?

  • 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. 2026-05-11T03:47:33+00:00Added an answer on May 11, 2026 at 3:47 am

    As the other answers point out, you will only be able handle XMLStatusMessage messages in AStatusHandler, but my guess is that this is what you want? Redeclare your interfaces as follows and I believe you will get what you want;

    public interface IMessageListener<T extends IMessage> {      public void onMessage(T message); }  public interface XMLMessageListener<T extends XMLMessage> extends IMessageListener<T> { }  public interface XMLStatusMessageListener extends XMLMessageListener<XMLStatusMessage> { } 

    Then you can create your message listener as follows;

    public class AStatusHandler implements XMLStatusMessageListener {      @Override     public void onMessage(final XMLStatusMessage message) {          // TODO Auto-generated method stub      }  } 

    Hope this is what you want, and that it helps.

    Regards Bent

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

Sidebar

Ask A Question

Stats

  • Questions 515k
  • Answers 515k
  • 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 try System.Web.HttpUtility.HtmlEncode(foo); you will need to add a reference to… May 16, 2026 at 6:25 pm
  • Editorial Team
    Editorial Team added an answer The extra tags can be removed selectively. I've given an… May 16, 2026 at 6:25 pm
  • Editorial Team
    Editorial Team added an answer The annotation is called @external for a reason :) It's… May 16, 2026 at 6:25 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

Related Questions

I have a few classes, such as those that outline database table structure or
I have an abstract base class with a TcpClient field: public abstract class ControllerBase
I have a few native C++ libraries and such that I need to expose
I have a few dll files and I want to export all public classes
I have the following classes. public class B { public A a; public B()
I have a few questions related to the design of my User class but
Say I've got a domain model created from C# classes like this: public class
I have a Ruby code with different classes in a few files. In one
I am working on a class library using C#. I have designed 3 main
One thing I've run into a few times is a service class (like a

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.