toString(), only use it to produce output for humans.
To create version instances of a particular version use the create(int. factory
method. Use getCurrent() to lookup the current GraalVM version or parse(String)
to parse it from a raw string.
if (Version.getCurrent().compareTo(19, 3) < 0) {
throw new IllegalStateException("Invalid GraalVM version. Must be at least 19.3.");
}
Note
this class has a natural ordering that is inconsistent with equals.
HomeFinder#getVersion()
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final boolean | |
| private static final String | |
| private static final String | |
| private final String | |
| private final int[] |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(Version
the object to be compared. o)Implements java. Compares this object with the specified object for order. |
| public int | compareTo(int...
the object to be compared. compareVersions)Implements java. Compares this version to another GraalVM version. |
| public static Version | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public String | |
| public static Version | |
| public int | |
| private static IllegalArgumentException | |
| public boolean | |
| public boolean | |
| public static Version | |
| private String | |
| public String | |
| private static int[] |
| MIN_VERSION_DIGITS | back to summary |
|---|---|
| private static final int MIN_VERSION_DIGITS | |
| snapshot | back to summary |
|---|---|
| private final boolean snapshot | |
| SNAPSHOT_STRING | back to summary |
|---|---|
| private static final String SNAPSHOT_STRING | |
| SNAPSHOT_SUFFIX | back to summary |
|---|---|
| private static final String SNAPSHOT_SUFFIX | |
| suffix | back to summary |
|---|---|
| private final String suffix | |
| versions | back to summary |
|---|---|
| private final int[] versions | |
| Version | back to summary |
|---|---|
| pack-priv Version(int... versions) | |
| Version | back to summary |
|---|---|
| pack-priv Version(String v) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(Version o) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| compareTo | back to summary |
|---|---|
| public int compareTo(int... compareVersions) Implements java. Compares this version to another GraalVM version. This is equivalent to using:
| |
| create | back to summary |
|---|---|
| public static Version create(int... versions) throws IllegalArgumentException Constructs a new GraalVM version from a list of version numbers. The versions must not be
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| format | back to summary |
|---|---|
| public String format(String format) Format the GraalVM version with a custom format string.
The format string can contain any of the standard conversions of In addition to the standard conversions, these special conversions are available:
Examples:
Version.parse("22.3.0.1").format("%d.%d"); // returns "22.3"
Version.parse("22.3.0.1").format("%4$d"); // returns "1"
Version.parse("22.3.0.1").format("%[R%d.%d]%[Sdev]"); // returns "22.3"
Version.parse("22.3.0.1").format("%[2XX]"); // returns "XX"
Version.parse("23.0-dev").format("%3$d"); // returns "0"
Version.parse("23.0-dev").format("%[R%d.%d]%[Sdev]"); // returns "dev"
Version.parse("23.0-dev").format("%[2XX]"); // returns ""
| |
| getCurrent | back to summary |
|---|---|
| public static Version getCurrent() Returns the current GraalVM version of the installed component. Never
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| invalid | back to summary |
|---|---|
| private static IllegalArgumentException invalid(String v) | |
| isRelease | back to summary |
|---|---|
| public boolean isRelease() Returns
| |
| isSnapshot | back to summary |
|---|---|
| public boolean isSnapshot() Returns
| |
| parse | back to summary |
|---|---|
| public static Version parse(String versionString) throws IllegalArgumentException Parses a GraalVM version from its String raw format. Throws
| |
| processFormat | back to summary |
|---|---|
| private String processFormat(String format) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| trimTrailingZeros | back to summary |
|---|---|
| private static int[] trimTrailingZeros(int[] intVersions) | |