Class IndentConfig

java.lang.Object
org.bluezoo.json.IndentConfig

public final class IndentConfig extends Object
Configuration for JSON output indentation.

Specifies the character to use for indentation (space or tab) and how many times to repeat it per indentation level.

Author:
Chris Burdess
  • Constructor Details

    • IndentConfig

      public IndentConfig(char indentChar, int indentCount)
      Creates an indent configuration.
      Parameters:
      indentChar - the character to use for indentation (' ' or '\t')
      indentCount - how many times to repeat the character per level (must be positive)
      Throws:
      IllegalArgumentException - if indentChar is not space or tab, or if count is not positive
  • Method Details

    • getIndentChar

      public char getIndentChar()
      Returns the character to use for indentation.
      Returns:
      the indent character (' ' or '\t')
    • getIndentCount

      public int getIndentCount()
      Returns how many times to repeat the indent character per level.
      Returns:
      the indent count
    • tabs

      public static IndentConfig tabs()
      Creates an indent configuration using tabs.
      Returns:
      configuration for single tab per level
    • spaces2

      public static IndentConfig spaces2()
      Creates an indent configuration using 2 spaces per level.
      Returns:
      configuration for 2 spaces per level
    • spaces4

      public static IndentConfig spaces4()
      Creates an indent configuration using 4 spaces per level.
      Returns:
      configuration for 4 spaces per level
    • spaces

      public static IndentConfig spaces(int count)
      Creates an indent configuration using the specified number of spaces per level.
      Parameters:
      count - the number of spaces per level
      Returns:
      configuration for the specified number of spaces per level
    • toString

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object