public final class IntVersion extends Object implements Comparable<IntVersion>
| Modifier and Type | Field and Description |
|---|---|
static CharSequence |
DEFAULT_DELIMITER |
| Constructor and Description |
|---|
IntVersion(int... segments)
Constructs a version with a variable number of segments.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(IntVersion version) |
boolean |
equals(Object object) |
int |
hashCode() |
int |
major()
Convenience method that returns the 1st segment of this version.
|
int |
micro()
Convenience method that returns the 3rd segment of this version.
|
int |
minor()
Convenience method that returns the 2nd segment of this version.
|
int |
segment(int index)
Returns the version segment at the specified index.
|
int |
segments()
Returns the number of segments with which this version was constructed, excluding any trailing zeros.
|
IntStream |
stream()
Returns a stream of the segments of this version, excluding any trailing zeros.
|
IntStream |
stream(int segments)
Returns a stream of the segments of this version, zero padded (or truncated) to the specified number of segments.
|
String |
toString()
Equivalent to
this.toString(this.segments()) |
String |
toString(int segments)
Prints this version using the
DEFAULT_DELIMITER segment delimiter, zero padded (or truncated) to the specified number of segments. |
String |
toString(int segments,
CharSequence delimiter)
Prints this version using the specified segment delimiter, zero padded (or truncated) to the specified number of segments.
|
public static final CharSequence DEFAULT_DELIMITER
public IntVersion(int... segments)
segments - the version segmentspublic int segment(int index)
index - a version segment indexArrayIndexOutOfBoundsException - if index is negativepublic int segments()
public int major()
this.segment(0).public int minor()
this.segment(1).public int micro()
this.segment(2).public IntStream stream()
stream(int) to obtain a stream of a specific length.public IntStream stream(int segments)
public int compareTo(IntVersion version)
compareTo in interface Comparable<IntVersion>public String toString()
this.toString(this.segments())public String toString(int segments)
DEFAULT_DELIMITER segment delimiter, zero padded (or truncated) to the specified number of segments.
Equivalent to this.toString(segments, DEFAULT_DELIMITER)the - number of segments with which to zero pad this version's string representationpublic String toString(int segments, CharSequence delimiter)
the - number of segments with which to zero pad this version's string representationa - version segment delimiterCopyright © 2024 JBoss by Red Hat. All rights reserved.