mercredi 28 juin 2017

Property file based conditional patterns in java

I have a property file (a.txt) which has the values (Example values given below) like below

test1=10  
test2=20  
test33=34  
test34=35  

By reading this file, I need to produce an output like below

value = 35_20_34_10

which means => I have a pattern like test34_test2_test33_test1

Note, If the 'test33' has any value other than 34 then I need to produce the value like below

value = 35_20_10

which means => I have a pattern like test34_test2_test1

Now my problem is, every time when the customer is making the change in the logic, I am making the change in the code. So what I expect is, I want to keep the logic (pattern) in another property file so I will be sending the two inputs to the util (one input is the property file (A.txt) another input will be the 'pattern.txt'),

My util has to be compare the A.txt and the business logic 'pattern.txt' and produce the output like

value = 35_20_34_10 (or) 
value = 35_20_10

If there an example for such pattern based logic as I expect? Any predefined util / java class does this?

Any help would be Great.

thanks, Harry

Aucun commentaire:

Enregistrer un commentaire