Reputation: 1307
I want to call a method in different class in a different package using the lines injected through javassist. Is there any other way to call those methods directly without making them public static and call using the fully qualified classname? In here it describes about a importPackage()
method. But it looks like it can be used only with classpool object where we try to obtain the required class file.
Upvotes: 2
Views: 2268
Reputation: 16066
Imports are compile time only. If you want to invoke non-static methods in another class, you will need some means of acquiring the correct object instances to invoke against, such as:
One of these would need to be injected into your class so you can get the instances, and then you can wire in the actual invocation.
It might be helpful if you provided some code samples, perhaps how the code is now, and how you would like it to be.
Upvotes: 2