I have an Java EE Application which should control many other applications.
The user has an interface to insert a searchstring and the tool checks many other applications for this string and the user gets a window where he can see te results out of the other tools.
To do so I have to write SearchEngines for every single application, because they all have other ways to be requested (direct Database, REST, SOAP, it doesn't matter). On top I set a class for every searchengine with all the same methodes (like isAlive, searchOne, searchList).
At the moment I use an ENUM where I put a value for the engine, a string for presentation in the apllication and the classname of the Interface-Class I mentioned above.
So everytime someone writes a new searchengine for another tool he has to make this interfaceClass und to put a new Enum-Value into the Enum for the engines.
Isn't there another (better) way of doing this. Maybe an annotation could do this job, so the application can find every class with the annotation. I haven't made my own annotaion til now.
I would be glad, if someone could tell me if there is a better way than ENUMs and Interfaces for this purpose.
Best regards Daniel