Record Class GameVersion
java.lang.Object
java.lang.Record
dev.overlord.zomboidforge.api.GameVersion
- All Implemented Interfaces:
Comparable<GameVersion>
public record GameVersion(int major, int minor, int build)
extends Record
implements Comparable<GameVersion>
Project Zomboid version, e.g. 42.21.0 (
Core.getGameAndBuildVersion()).-
Constructor Summary
ConstructorsConstructorDescriptionGameVersion(int major, int minor, int build) Creates an instance of aGameVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintbuild()Returns the value of thebuildrecord component.intcompareTo(GameVersion other) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisAtLeast(int major, int minor) booleanisBefore(int major, int minor) static booleanWhethertextis a version prefix formatches(String): "42", "42.21", or "42.21.0".intmajor()Returns the value of themajorrecord component.booleanWhether this version starts withprefix: "42" matches every 42.x.y, "42.21" every 42.21.x, "42.21.0" only 42.21.0.intminor()Returns the value of theminorrecord component.static GameVersionParses "42.21.0", or "42.21" as 42.21.0.toString()Returns a string representation of this record class.
-
Constructor Details
-
GameVersion
public GameVersion(int major, int minor, int build) Creates an instance of aGameVersionrecord class.- Parameters:
major- the value for themajorrecord componentminor- the value for theminorrecord componentbuild- the value for thebuildrecord component
-
-
Method Details
-
parse
Parses "42.21.0", or "42.21" as 42.21.0. -
isPrefix
Whethertextis a version prefix formatches(String): "42", "42.21", or "42.21.0". -
matches
Whether this version starts withprefix: "42" matches every 42.x.y, "42.21" every 42.21.x, "42.21.0" only 42.21.0. -
isAtLeast
public boolean isAtLeast(int major, int minor) -
isBefore
public boolean isBefore(int major, int minor) -
compareTo
- Specified by:
compareToin interfaceComparable<GameVersion>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
major
public int major()Returns the value of themajorrecord component.- Returns:
- the value of the
majorrecord component
-
minor
public int minor()Returns the value of theminorrecord component.- Returns:
- the value of the
minorrecord component
-
build
public int build()Returns the value of thebuildrecord component.- Returns:
- the value of the
buildrecord component
-