public class VersionIdentifierFormatterVersionSegments extends AbstractFormatter<VersionIdentifier>
Formatter
for the plain
version number
.Modifier and Type | Field and Description |
---|---|
private int |
maximumSegmentCount
The maximum number of segments to format.
|
private int |
minimumSegmentCount
The minimum number of segments to format.
|
private String |
prefix
The static prefix.
|
private int |
segmentPadding
The padding for
segments . |
private String |
segmentSeparator
The separator for
segments . |
private StringUtil |
stringUtil
The
StringUtil instance. |
Constructor and Description |
---|
VersionIdentifierFormatterVersionSegments(StringUtil stringUtil,
String prefix,
String segmentSeparator,
int minimumSegmentCount,
int maximumSegmentCount,
int segmentPadding)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doFormat(VersionIdentifier value,
Appendable buffer) |
protected CharSequence |
doFormatSegment(VersionIdentifier value,
int index)
This method formats the
segment at the given index . |
format, format, formatNull
private final StringUtil stringUtil
StringUtil
instance.private final String prefix
private final int minimumSegmentCount
private final int maximumSegmentCount
private final int segmentPadding
segments
.public VersionIdentifierFormatterVersionSegments(StringUtil stringUtil, String prefix, String segmentSeparator, int minimumSegmentCount, int maximumSegmentCount, int segmentPadding)
stringUtil
- is the StringUtil
instance.prefix
- is the static prefix to append before the number. Will be omitted if the number is null
.segmentSeparator
- is the separator for segments
. The typical
value is the dot sign (".").minimumSegmentCount
- is the minimum number of segments to format. The default is 0
.maximumSegmentCount
- is maximum number of segments to format. The default is Integer.MAX_VALUE
.segmentPadding
- is the padding (minimum number of digits) for each
segment
. The default is 0
.protected void doFormat(VersionIdentifier value, Appendable buffer) throws IOException
doFormat
in class AbstractFormatter<VersionIdentifier>
value
- is the value to format (not null
).buffer
- is the Appendable
to append
the formatted value to.IOException
- if caused by append
.AbstractFormatter.format(Object, Appendable)
protected CharSequence doFormatSegment(VersionIdentifier value, int index)
segment
at the given index
.value
- is the VersionIdentifier
.index
- is the index of the segment
to format.Copyright © 2001–2016 mmm-Team. All rights reserved.