Class PrettyPrintingDecorator<M extends ObjectMapper, B extends MapperBuilder<M,B>>

java.lang.Object
net.logstash.logback.decorate.PrettyPrintingDecorator<M,B>
All Implemented Interfaces:
Decorator<B>, MapperBuilderDecorator<M,B>

public class PrettyPrintingDecorator<M extends ObjectMapper, B extends MapperBuilder<M,B>> extends Object implements MapperBuilderDecorator<M,B>
Enables pretty printing on a MapperBuilder.
  • Constructor Details

    • PrettyPrintingDecorator

      public PrettyPrintingDecorator()
  • Method Details

    • decorate

      public B decorate(B mapperBuilder)
      Description copied from interface: Decorator
      Decorates the given decoratable.
      Specified by:
      decorate in interface Decorator<M extends ObjectMapper>
      Parameters:
      mapperBuilder - the object to decorate
      Returns:
      the decorated object (can be a different from the object passed in as an arg)
    • setRootSeparator

      public void setRootSeparator(String rootSeparator)
      Sets the root separator used by the pretty printer.

      Replaces occurrences of the string literal [SPACE] with a space character to work around the fact that logback trims values read from xml before calling the setter. Therefore, to set the root separator to a single space, you can specify <rootSeparator>[SPACE]</rootSeparator> in the xml configuration.

      Parameters:
      rootSeparator - the new root separator
      See Also:
    • setSpacesInObjectEntries

      public void setSpacesInObjectEntries(boolean spacesInObjectEntries)
      Sets whether spaces appear in object entries.
      Parameters:
      spacesInObjectEntries - whether spaces appear in object entries.
      See Also:
    • setIndentArraysWithNewLine

      public void setIndentArraysWithNewLine(boolean indentArraysWithNewLine)
      Sets whether arrays are indented with a new line.
      Parameters:
      indentArraysWithNewLine - whether arrays are indented with a new line.