public class IndentPadding extends Object implements Cloneable
To use this, create the object and set any parameters you like and call
JSONConfig.setIndentPadding(IndentPadding) to add it to your config
object and use it when you convert to JSON.
This class is NOT thread safe. Do not reuse this object in different threads.
If you reuse JSONConfig objects in the same thread, then you should probably
call reset() before calling JSONUtil's toJSON() methods just to be
safe (but not inside JSONAbles that have a JSONConfig object sent to
them and use JSONUtil to generate their JSON).
| Constructor and Description |
|---|
IndentPadding()
Create an indent padding object using four spaces and a standard newline.
|
IndentPadding(String indent,
String newLine)
Create an indent padding object with the given indent and newLine
strings.
|
| Modifier and Type | Method and Description |
|---|---|
IndentPadding |
clone() |
void |
decrementLevel()
Decrement the level of indent.
|
String |
getIndent()
Get the spacing for one indent level.
|
String |
getNewLine()
Get the string to use for a new line (default \n)
|
String |
getPadding()
Get the padding for the current indent level.
|
void |
incrementLevel()
Increment the level of indent.
|
void |
reset()
Reset this object's operating data.
|
void |
setIndent(String indent)
Set the spacing for one indent level (default is 4 spaces).
|
void |
setNewLine(String newLine)
Set the string to use for a new line (default \n).
|
public IndentPadding()
public IndentPadding clone()
public void reset()
public String getIndent()
public void setIndent(String indent)
indent - The spacing for one indent level.public void incrementLevel()
public void decrementLevel()
public String getNewLine()
public void setNewLine(String newLine)
Set the string to use for a new line (default \n). A string is used so that you can use \r\n or other new line sequences if you like.
For example, if you wanted a platform specific newLine, you could do this:
setNewLine(String.format("%n"));
newLine - The string to use for a new line (default \n)public String getPadding()
Copyright © 2016. All rights reserved.