Class MultiGroupConversionRule

  • All Implemented Interfaces:
    ConversionRule

    public class MultiGroupConversionRule
    extends java.lang.Object
    implements ConversionRule
    This class represents a conversion rule It uses a Pattern and defines for each capturing group of this Pattern a replacement text
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int MAX_GROUPS  
      private java.util.regex.Pattern pattern  
      private java.lang.String[] replacementTable  
    • Constructor Summary

      Constructors 
      Constructor Description
      MultiGroupConversionRule​(java.util.regex.Pattern pattern)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addReplacement​(int groupIndex, java.lang.String replacement)  
      java.lang.String getAdditionalLine()
      Returns a non-null value if there should be an additional line following a match of this rule.
      java.util.regex.Pattern getPattern()  
      java.lang.String getReplacement​(int groupIndex)  
      java.lang.String replace​(java.util.regex.Matcher matcher)
      Given replacement rules, replace each capturing group in matcher's pattern
      • Methods inherited from class java.lang.Object

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

      • pattern

        private java.util.regex.Pattern pattern
      • replacementTable

        private java.lang.String[] replacementTable
    • Constructor Detail

      • MultiGroupConversionRule

        public MultiGroupConversionRule​(java.util.regex.Pattern pattern)
    • Method Detail

      • addReplacement

        public void addReplacement​(int groupIndex,
                                   java.lang.String replacement)
      • getReplacement

        public java.lang.String getReplacement​(int groupIndex)
      • replace

        public java.lang.String replace​(java.util.regex.Matcher matcher)
        Description copied from interface: ConversionRule
        Given replacement rules, replace each capturing group in matcher's pattern
        Specified by:
        replace in interface ConversionRule
        Returns:
        String
      • getAdditionalLine

        public java.lang.String getAdditionalLine()
        Description copied from interface: ConversionRule
        Returns a non-null value if there should be an additional line following a match of this rule. In most cases this method returns null.
        Specified by:
        getAdditionalLine in interface ConversionRule
        Returns:
        String