In a properties file I'm loading a String containing (with delimiters and a Regular expression) method names I want to dynamically invoke from Java.
For example : "%getProductName%-%GetProductCode%[-]*[0-9]*\.(.+)"
When the String get's read from the properties file, I want to replace the method names (between %%) with their return value when the method is called.
But I'm not quite sure how to accomplish following in Java (best practice):
- Parse string & retrieve all the %methodNames%
variables.
After retrieving the different methods defined in the String, I will retrieve the result using Reflection and replacing this value in the original String.
I'm just looking for a quick approach regarding parsing the String and retrieving the different %methodNames%
.
Thanks for any advice!