在Java中,给定一个对象,是否可以重写其中一种方法?

在Java中,给定一个对象,是否可以重写其中一种方法?

问题描述:

我有一个类A的对象。我想重写该类的方法之一。能做到吗?

I have an object of class A. I want to override one of the methods of that class. Can this be done?

更具体地说,我有一个被注入到字段中的对象。在使用它之前,我需要重写其中一种方法。

More specifically, I have an object that is being injected into a field. I need to override one of the methods, before I can use it.

我正在尝试查看反射是否可以帮助解决问题。请注意,我尝试覆盖的方法不依赖于该类的私有变量。

I am trying to see if Reflection could help solve the problem. Note that the method that I am trying override does not dependent on private variables of that class.

查看动态代理类