- java.lang.Object
-
- org.bluezoo.json.IndentConfig
-
public final class IndentConfig extends java.lang.ObjectConfiguration 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
Constructors Constructor Description IndentConfig(char indentChar, int indentCount)Creates an indent configuration.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)chargetIndentChar()Returns the character to use for indentation.intgetIndentCount()Returns 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.java.lang.StringtoString()
-
-
-
Constructor Detail
-
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:
java.lang.IllegalArgumentException- if indentChar is not space or tab, or if count is not positive
-
-
Method Detail
-
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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-