Class YAMLPropertyWriter

    • Constructor Detail

      • YAMLPropertyWriter

        public YAMLPropertyWriter​(Writer _writer)
        Default constructor with ignoreListLength set true
        Parameters:
        _writer - parent reader
      • YAMLPropertyWriter

        public YAMLPropertyWriter​(Writer _writer,
                                  boolean _ignoreListLength)
        Constructor capable to define ignoreListLength value
        Parameters:
        _writer - parent reader
        _ignoreListLength - ignore list length and do not append it
    • Method Detail

      • append

        protected final void append​(int _depth,
                                    String _name,
                                    String _value,
                                    boolean _isList)
                             throws IOException
        Append to the underlaying stream the correct yaml format for the given fields
        Parameters:
        _depth - number of tabs to use (double space)
        _name - key name
        _value - value
        _isList - flag to indicate if is a list
        Throws:
        IOException - if something happens
      • calculateTabs

        protected int calculateTabs()
        Accumulate the current entryPathCache tabulation considering that each list counts double
        Returns:
        number of tabs in entryPathCache counting lists as double
      • append

        protected void append​(YAMLPropertyWriter.YamlEntry _yamlEntry)
        Write down the given yaml entry
        Parameters:
        _yamlEntry - property to append
      • filterLength

        protected final boolean filterLength​(YAMLPropertyWriter.Property _property)
        Return true if ignoreListLength is disabled or the property is not length (ends with [*].length)
        Parameters:
        _property - property to validate
        Returns:
        true if and only if ignoreListLength is disabled or the property is not length
      • write

        public void write​(Stream<YAMLPropertyWriter.Property> _stream)
        Write down all stream elements until end of stream IMPORTANT: its mandatory to provide the stream ordered, otherwise will have unexpected results
        Parameters:
        _stream - stream of properties to append
      • append

        public void append​(YAMLPropertyWriter.Property _property)
        Write down the given property
        Parameters:
        _property - property to append