Class NormalizedDefinition

java.lang.Object
com.yahoo.config.codegen.NormalizedDefinition

public class NormalizedDefinition extends Object
Does normalizing (removing comments, trimming whitespace etc.) and calculation of md5sum of config definitions
Author:
hmusum
  • Constructor Details

    • NormalizedDefinition

      public NormalizedDefinition()
  • Method Details

    • normalize

      public NormalizedDefinition normalize(BufferedReader reader) throws IOException
      Throws:
      IOException
    • normalize

      public static String normalize(String line)
      Normalizes a config definition line. Each string is normalized according to the rules of config and definition files before they are used:
      • Remove trailing space.
      • Remove trailing comments, and spaces before trailing comments.
      • Remove empty lines
      • Keep comment lines
      The supplied list is changed in-place
      Parameters:
      line - a config definition line
      Returns:
      a normalized config definition line
    • addNormalizedLine

      public void addNormalizedLine(String line)
    • generateMd5Sum

      public String generateMd5Sum()
    • toBytes

      public static byte[] toBytes(String str)
    • stripSpaces

      public static String stripSpaces(String str)
      Replaces sequences of spaces with 1 space, unless inside quotes. Public for testing.
      Parameters:
      str - String to strip spaces from
      Returns:
      String with spaces stripped
    • getNormalizedContent

      public List<String> getNormalizedContent()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDefMd5

      public String getDefMd5()