Class ParameterRefReplacer


  • public class ParameterRefReplacer
    extends ParameterRefParser
    Facilitates the process of parameterised strings and replace the parameter references with values. It works similarly to Matcher and is supposed to be used in a loop like this:
     ParameterRefReplacer replacer = ...
     while (replacer.findNext())
     {
       ... replacer.getName() ...
       ... replacer.getDataType() ...
       ...
       replacer.replaceWith(<someValue>);
     }
     System.out.println(replacer.getProcessedString());
     
    Instances are created using ParameterRefTools.getReplacer(String, EnumSet) or other specialised variants like SystemDataTools.getReplacer(String).
    • Method Detail

      • findNext

        public boolean findNext()
        Finds the next parameter reference. Once this method returns false the processed string is complete.
        Overrides:
        findNext in class ParameterRefParser
        Returns:
        if a next parameter reference was found
      • replaceWith

        public void replaceWith​(String string)
        Replace the current parameter reference with the specified string. This method is optional, i.e. not every parameter reference must be replaced.
        Parameters:
        string - the string to replace the current parameter reference with
      • getProcessedString

        public String getProcessedString()
        Returns the processed string.
        Returns:
        the processed string