public final class FormattingInfo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static FormattingInfo |
DEFAULT
Default instance.
|
private boolean |
leftAlign
Alignment.
|
private boolean |
leftTruncate
Left vs.
|
private int |
maxLength
Maximum length.
|
private int |
minLength
Minimum length.
|
private static char[] |
SPACES
Array of spaces.
|
private boolean |
zeroPad
Use zero-padding instead whitespace padding
|
private static char[] |
ZEROS
Array of zeros.
|
Constructor and Description |
---|
FormattingInfo(boolean leftAlign,
int minLength,
int maxLength,
boolean leftTruncate)
Creates new instance.
|
FormattingInfo(boolean leftAlign,
int minLength,
int maxLength,
boolean leftTruncate,
boolean zeroPad)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
format(int fieldStart,
java.lang.StringBuilder buffer)
Adjust the content of the buffer based on the specified lengths and alignment.
|
static FormattingInfo |
getDefault()
Gets default instance.
|
int |
getMaxLength()
Get maximum length.
|
int |
getMinLength()
Get minimum length.
|
boolean |
isLeftAligned()
Determine if left aligned.
|
boolean |
isLeftTruncate()
Determine if left truncated.
|
boolean |
isZeroPad()
Determine if zero-padded.
|
java.lang.String |
toString()
Returns a String suitable for debugging.
|
private static final char[] SPACES
private static final char[] ZEROS
private static final FormattingInfo DEFAULT
private final int minLength
private final int maxLength
private final boolean leftAlign
private final boolean leftTruncate
private final boolean zeroPad
public FormattingInfo(boolean leftAlign, int minLength, int maxLength, boolean leftTruncate)
leftAlign
- left align if true.minLength
- minimum length.maxLength
- maximum length.leftTruncate
- truncates to the left if truepublic FormattingInfo(boolean leftAlign, int minLength, int maxLength, boolean leftTruncate, boolean zeroPad)
leftAlign
- left align if true.minLength
- minimum length.maxLength
- maximum length.leftTruncate
- truncates to the left if truezeroPad
- use zero-padding instead of whitespace-paddingpublic static FormattingInfo getDefault()
public boolean isLeftAligned()
public boolean isLeftTruncate()
public boolean isZeroPad()
public int getMinLength()
public int getMaxLength()
public void format(int fieldStart, java.lang.StringBuilder buffer)
fieldStart
- start of field in buffer.buffer
- buffer to be modified.public java.lang.String toString()
toString
in class java.lang.Object