Determine which Class-Member holds specific Value

Viewed 16

I have several Classes which request Information from different Web-APIs. The details which are needed for the Web-API (e.g. Host / QueryParameter / API-Key) differ in every Class, so i dont have 1 Class-Field, with the same name, which holds the Host and so on.

For Example:

Class A)

String host = "..."

Class B)

String url = "..."

Now i want to extend these Classes, with a Monitoring-Class, to monitore the availability of the Web-API. This Monitoring-Class should use the Values of the Parent-Class to execute the monitoring-methods. My Problem with this is, that i want to determine which Class-Field holds the Information which i need, is there any good-to-go way to do this ?

Or do i rather have to rewrite these Classes to hold the API-details i need in a more consistent way ?

My only idea so far, is to rewrite these Classes, but there are up to 100 of them and i want see if there are more dynamical solutions.

0 Answers
Related