Answer the question
In order to leave comments, you need to log in
How to make an interface to a Java program?
Let's say I'm writing an engine that has some kind of business logic and data storage structure, similar to 1C.
If I want users to be able to add their own Java plugins to my engine, I will need to describe the API classes for them, but I didn’t understand where to start and how it works.
When I try to google, a solid web api pops up, and I need NOT a WEB interface.
Please tell me what to read on this topic.
Answer the question
In order to leave comments, you need to log in
Start by understanding microsoft DLLs, COMs, DCOMs, they were the first to go down this path.
Then read about loading java classes
Usually I start writing a big program, with new logic and in a calm environment (without the rage of managers and directors), by describing the abstract necessary functionality on the interfaces. And then I will implement it.
This is especially useful when you are not writing alone. In this case, you implement your own interfaces agreed with the team, calmly referring to unrealized ones that others implement, without slowing you down at the beginning.
In your case, you can (I know this only for JIdea) create and debug a really working class. And then, right-clicking on the name of this class and then from the pop-up menu "Refactor"->"Extract interface". And voila, if there are no bad dependencies, then the interface (in the sense of Java syntax and as a separate class file) is ready. It remains to correctly comment it out and, perhaps, implement some default methods, transferring them from the already written code. Or whatever else is required. But most importantly, the interface for working methods is already there.
And to implement the interface in the plug-in is a matter of technology. Loading a plugin and calling it as an instance of an interface class is also not difficult.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question