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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:51:32+00:00 2026-06-12T03:51:32+00:00

Is there a way to define a default, or fallback, overriding method that can

  • 0

Is there a way to define a default, or fallback, overriding method that can handle any unhandled methods?

The reason I ask this is because I’ve made a class to override a class in a function library that is constantly subject to change. In order to successfully compile the class, all methods must be defined and overridden, but I don’t really want to be recoding my class every time there is an update.

Here’s an example of what’s written:

public class CommandSignsPlayerProxy implements Player {

    private Player proxy;
    private boolean silent;

    public CommandSignsPlayerProxy(Player targetPlayer) {
        this.proxy = targetPlayer;
    }

    public boolean isSilent() {
        return silent;
    }

    public void setSilent(boolean silent) {
        this.silent = silent;
    }

    @Override
    public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
        proxy.abandonConversation(conversation, details);
    }

    // This function is basically the only one that NEEDS overriding
    @Override
    public void sendMessage(String message) {
        if (!silent)
            proxy.sendMessage(message);
    }

    @Override
    public void setFlySpeed(float arg0) throws IllegalArgumentException {
        proxy.setFlySpeed(arg0);
    }

}

In the real code, there is another 50+ overridden functions. So is there a way to make an automatic handler that overrides function_name() with proxy.function_name()?

  • 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-06-12T03:51:33+00:00Added an answer on June 12, 2026 at 3:51 am

    A Dynamic Proxy may be able to do this. From the documentation:

    A dynamic proxy class is a class that implements a list of interfaces
    specified at runtime such that a method invocation through one of the
    interfaces on an instance of the class will be encoded and dispatched
    to another object through a uniform interface. Thus, a dynamic proxy
    class can be used to create a type-safe proxy object for a list of
    interfaces without requiring pre-generation of the proxy class, such
    as with compile-time tools.

    Method invocations on an instance of a dynamic proxy class are
    dispatched to a single method in the instance’s invocation handler,
    and they are encoded with a java.lang.reflect.Method object
    identifying the method that was invoked and an array of type Object
    containing the arguments.

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

Sidebar

Related Questions

Is there any way to define a variable that can be used in multiple
Given that one can define a class in VB Script, is there any way
I was wondering is there any way to define default respond_to for index &
I was wondering if there were any way to define the default encoding for
Is there a way to define custom codes (with messages/descriptions and whatnot) so that
is there any way to define objects in hibernate.cfg.xml by scope and not one
Question Is there a way to define a method only once in C# (in
Hi All is there any way to locally define a variable in a function
Is there any way to define which options in Zend_Form_Element_MultiSelect would be selected by
Is there any way to view the default functions ( e.g., default copy constructor,

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.