lundi 21 mai 2018

calling java classes at runtime on conditions

I am asking one design level interview problem with context to core java,I have one excel sheet contaning 3 coulumns that same I have stored in database in a table named details

Jobcode   networkId    BuisnessRule

A          11            XYZ
A          16            QWE
B          12            ERT

Now please advise from the design point of view what I have done is that uiser will have the value of jobcode so lets say the user will have the jobcode A , so he will fetch the network id with context to job code so for A there will be two network id that is 11 and 16 now upon these network ids we have two different buisness rule that is XYZ on network id 11 and QWE on networkId 16

now what i have done i have maintained an spring map so that it get intialised when my app starts as it is static data as shown below

 <map>
  <entry key="11" value="com.Mapping.XYZMappingBuisnessRule"/>
  <entry key="16" value="com.Mapping.QWEMappingBuisnessRule"/>
  </map>

now what I have been planning is that once the networkId is retrieved by the user then following classes XYZMappingBuisnessRule and QWEMappingBuisnessRule will be called and each of these classes will have exceute method to call the buisness rule and these classes will be called at runtime as soon as the network id isnidentified , please advise is it the correct design

My concern is that as the count of buisness rule increases the count of classes also increases in this design

Aucun commentaire:

Enregistrer un commentaire