toml4j/src/main/java/com/moandjiezana/toml/WriterIndentationPolicy.java
Jonathan Wood 72941c146d Add writer indentation policy controls.
Set the default indentation to 0.
2015-06-28 10:30:35 -07:00

42 lines
1 KiB
Java

package com.moandjiezana.toml;
/**
* Controls how a {@link TomlWriter} indents tables and key/value pairs.
*
* The default policy is to not indent.
*/
public class WriterIndentationPolicy {
private int tableIndent = 0;
private int keyValueIndent = 0;
public int getTableIndent() {
return tableIndent;
}
/**
* Sets the number of spaces a nested table name is indented.
*
* @param tableIndent number of spaces to indent
* @return this WriterIndentationPolicy instance
*/
public WriterIndentationPolicy setTableIndent(int tableIndent) {
this.tableIndent = tableIndent;
return this;
}
public int getKeyValueIndent() {
return keyValueIndent;
}
/**
* Sets the number of spaces key/value pairs within a table are indented.
*
* @param keyValueIndent number of spaces to indent
* @return this WriterIndentationPolicy instance
*/
public WriterIndentationPolicy setKeyValueIndent(int keyValueIndent) {
this.keyValueIndent = keyValueIndent;
return this;
}
}