Class StringReplacer


  • public class StringReplacer
    extends java.lang.Object
    Replaces 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
      void replace​(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.
      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.
      void setPattern​(java.lang.String regex)
      Sets the pattern used to find class and package identifiers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringReplacer

        public StringReplacer​(java.lang.String patternString)
        Creates a new instance of StringReplacer
        Parameters:
        patternString - the pattern string
    • 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.IOException
        Replaces 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