Package com.yworks.yguard
Class StringReplacer
- java.lang.Object
-
- com.yworks.yguard.StringReplacer
-
public class StringReplacer extends java.lang.ObjectReplaces class and package identifiers with the corresponding renamed identifiers.
-
-
Constructor Summary
Constructors Constructor Description StringReplacer(java.lang.String patternString)Creates a new instance of StringReplacer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidreplace(java.io.Reader in, java.io.Writer out, java.util.function.Function<java.lang.String,java.lang.String> map)Replaces class and package identifiers in the given text.voidreplace(java.lang.String in, java.lang.StringBuffer out, java.util.function.Function<java.lang.String,java.lang.String> map)Replaces class and package identifiers in the given line of text.voidsetPattern(java.lang.String regex)Sets the pattern used to find class and package identifiers.
-
-
-
Method Detail
-
setPattern
public void setPattern(java.lang.String regex)
Sets the pattern used to find class and package identifiers.- Parameters:
regex- the regular expression to be used as pattern.
-
replace
public void replace(java.lang.String in, java.lang.StringBuffer out, java.util.function.Function<java.lang.String,java.lang.String> map)Replaces class and package identifiers in the given line of text.- Parameters:
in- the line of text in which to replace identifers.out- the line of text with renamed identifiers.map- a function that maps class and package identifiers to renamed identifiers.
-
replace
public void replace(java.io.Reader in, java.io.Writer out, java.util.function.Function<java.lang.String,java.lang.String> map) throws java.io.IOExceptionReplaces class and package identifiers in the given text.- Parameters:
in- the text in which to replace identifers.out- the text with renamed identifiers.map- a function that maps class and package identifiers to renamed identifiers.- Throws:
java.io.IOException
-
-