Class ParameterRefReplacer
- java.lang.Object
-
- de.aristaflow.adept2.model.common.paramref.ParameterRefParser
-
- de.aristaflow.adept2.model.common.paramref.ParameterRefReplacer
-
public class ParameterRefReplacer extends ParameterRefParser
Facilitates the process of parameterised strings and replace the parameter references with values. It works similarly toMatcher
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 usingParameterRefTools.getReplacer(String, EnumSet)
or other specialised variants likeSystemDataTools.getReplacer(String)
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
findNext()
Finds the next parameter reference.String
getProcessedString()
Returns the processed string.void
replaceWith(String string)
Replace the current parameter reference with the specified string.-
Methods inherited from class de.aristaflow.adept2.model.common.paramref.ParameterRefParser
getDataType, getEnd, getName, getParameterisedString, getParameterRef, getStart, getUdtName
-
-
-
-
Method Detail
-
findNext
public boolean findNext()
Finds the next parameter reference. Once this method returnsfalse
theprocessed string
is complete.- Overrides:
findNext
in classParameterRefParser
- 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
-
-