I have a requirement where value of one field in an object will be determined dynamically using a configurable table. For example, suppose I have the following table -

Pk | Reference_column


where TAB_REF is a reference table and AMOUNT is one of the column of TAB_REF table.
If above value exists in the database, the amount in the application will be obtained from the TAB_REF.AMOUNT column.
My requirement is, for the above dataset I will have a class called TabRef and that class will have a method getAmount(). I have to identify the class and the method in my application using the above value.

My idea is to writing an API which will create the Class name with the substring before (.) and another API to generate the method with substring after (.). But I don't think this is a good idea. Is there any better idea to accomplish the requirement? Please suggest, thanks in advance.

5 Years
Discussion Span
Last Post by NormR1

Using a String to get access to a class sounds like you need to use a Map or reflection.
Using a String to create a call to a method sounds like you would need to use reflection.

Edited by NormR1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.