|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object logahawk.SimpleIndentor
@Immutable public class SimpleIndentor
Simple implementation of Indentor
that repeats a provided string for the indent.
Instances of this class should be shared between ArgumentFormatter
s where possible, as this class uses an
internal cache to speed up calls to buildIndent(int)
for the common cases.
Field Summary | |
---|---|
static SimpleIndentor |
SPACE_1
A single space (ie: " ") reusable SimpleIndentor instance. |
static SimpleIndentor |
SPACE_2
A double space (ie: " ") reusable SimpleIndentor instance. |
static SimpleIndentor |
SPACE_4
Four spaces (ie: " ") reusable SimpleIndentor instance. |
static SimpleIndentor |
SPACE_8
Eight spaces (ie: " ") reusable SimpleIndentor instance. |
static SimpleIndentor |
TAB
Tab character (ie: "\t") reusable SimpleIndentor instance. |
Constructor Summary | |
---|---|
SimpleIndentor(String singleIndent)
|
Method Summary | |
---|---|
protected String |
buildIndent(int indentLevel)
Creates indents strings; does not use cache . |
String |
createIndent(int indentLevel)
Returns the string that should be used for indenting. |
String |
getSingleIndent()
The string used for a single indent (ie: indent level 1). |
void |
indent(List<String> values,
int indentLevel,
boolean indentFirstLine)
Indents a collection of Strings, replacing the un-indented strings with indented Strings. |
void |
indent(List<String> values,
List<Integer> indentLevels)
Indents a collection of strings, replacing the un-indented strings with indented Strings of varying indent levels. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final SimpleIndentor SPACE_1
SimpleIndentor
instance.
public static final SimpleIndentor SPACE_2
SimpleIndentor
instance.
public static final SimpleIndentor SPACE_4
SimpleIndentor
instance.
public static final SimpleIndentor SPACE_8
SimpleIndentor
instance.
public static final SimpleIndentor TAB
SimpleIndentor
instance.
Constructor Detail |
---|
public SimpleIndentor(String singleIndent)
Method Detail |
---|
public String getSingleIndent()
public String createIndent(int indentLevel)
Indentor
createIndent
in interface Indentor
public void indent(List<String> values, int indentLevel, boolean indentFirstLine)
Indentor
indent
in interface Indentor
values
- It is HIGHLY RECOMMENDED that this collection have O(1) get and set operations.indentFirstLine
- Whether to indent the first line or not. For most uses this will be false, in accordance
with the behavior expected by ArgumentFormatter.format(Object, Collection, int)
public void indent(List<String> values, List<Integer> indentLevels)
Indentor
Indentor.indent(List, int, boolean)
except that each String is indented a variable number of
times AND the first line will be indented (if desired). The index used by the "values" parameter is used to find
the indent level in parameter "indentLevels".
indent
in interface Indentor
values
- It is HIGHLY RECOMMENDED that this collection have O(1) get and set operations.protected String buildIndent(int indentLevel)
cache
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |