public final class Version extends Object implements Comparable<Version>
Version.toString(), only use it to produce output for humans.
To create version instances of a particular version use the Version.create(int...) factory
method. Use Version.getCurrent() to lookup the current GraalVM version or Version.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 | Method and Description |
|---|---|
int |
compareTo(int... compareVersions)
Compares this version to another GraalVM version.
|
int |
compareTo(Version o) |
static Version |
create(int... versions)
Constructs a new GraalVM version from a list of version numbers.
|
boolean |
equals(Object obj) |
static Version |
getCurrent()
Returns the current GraalVM version of the installed component.
|
int |
hashCode() |
boolean |
isRelease()
Returns
true if this is a supported release build of GraalVM else
false. |
boolean |
isSnapshot()
Returns
true if this is an unsupported snapshot build of GraalVM else
false. |
static Version |
parse(String versionString)
Parses a GraalVM version from its String raw format.
|
String |
toString() |
public boolean isRelease()
true if this is a supported release build of GraalVM else
false. Use this for implementation assertions that verify that only releases are
deployed to production.Version.isSnapshot()public boolean isSnapshot()
true if this is an unsupported snapshot build of GraalVM else
false. Use this for implementation assertions that verify that only releases are
deployed to production.Version.isSnapshot()public int compareTo(Version o)
compareTo in interface Comparable<Version>public int compareTo(int... compareVersions)
compareTo(Version.create(compareVersions))
.public static Version parse(String versionString) throws IllegalArgumentException
IllegalArgumentException
if the passed string is not a valid GraalVM version.IllegalArgumentExceptionpublic static Version create(int... versions) throws IllegalArgumentException
null and none of the version numbers must be negative. At least one version
number must be non-zero.IllegalArgumentExceptionVersion.compareTo(int...)public static Version getCurrent()
null.HomeFinder.getVersion()