java.lang.Object
org.bluezoo.json.IndentConfig
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 Summary
ConstructorsConstructorDescriptionIndentConfig(char indentChar, int indentCount) Creates an indent configuration. -
Method Summary
Modifier and TypeMethodDescriptionbooleancharReturns the character to use for indentation.intReturns how many times to repeat the indent character per level.inthashCode()static IndentConfigspaces(int count) Creates an indent configuration using the specified number of spaces per level.static IndentConfigspaces2()Creates an indent configuration using 2 spaces per level.static IndentConfigspaces4()Creates an indent configuration using 4 spaces per level.static IndentConfigtabs()Creates an indent configuration using tabs.toString()
-
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
Creates an indent configuration using tabs.- Returns:
- configuration for single tab per level
-
spaces2
Creates an indent configuration using 2 spaces per level.- Returns:
- configuration for 2 spaces per level
-
spaces4
Creates an indent configuration using 4 spaces per level.- Returns:
- configuration for 4 spaces per level
-
spaces
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
-
equals
-
hashCode
public int hashCode()
-