Record Class CloudNetVersion
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.CloudNetVersion
- Record Components:
major- the current major version of CloudNet.minor- the current minor version of CloudNet.patch- the current patch number of the current CloudNet minor version.revision- the git revision CloudNet is running on, empty if unknown.versionType- the current version type of CloudNet (for example snapshot).versionTitle- the current release title of CloudNet.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for themajorrecord component.private final intThe field for theminorrecord component.private final intThe field for thepatchrecord component.The field for therevisionrecord component.private static final PatternThe field for theversionTitlerecord component.The field for theversionTyperecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static @NonNull CloudNetVersionfromPackage(@NonNull Package source) Reads and tries to parse the CloudNet version from the information provided by the specified package.final inthashCode()Returns a hash code value for this object.intmajor()Returns the value of themajorrecord component.intminor()Returns the value of theminorrecord component.intpatch()Returns the value of thepatchrecord component.revision()Returns the value of therevisionrecord component.toString()Converts this version back to a human-readable string.Returns the value of theversionTitlerecord component.Returns the value of theversionTyperecord component.
-
Field Details
-
major
private final int majorThe field for themajorrecord component. -
minor
private final int minorThe field for theminorrecord component. -
patch
private final int patchThe field for thepatchrecord component. -
revision
-
versionType
The field for theversionTyperecord component. -
versionTitle
The field for theversionTitlerecord component. -
VERSION_PATTERN
-
-
Constructor Details
-
CloudNetVersion
public CloudNetVersion(int major, int minor, int patch, @NonNull @NonNull String revision, @NonNull @NonNull String versionType, @NonNull @NonNull String versionTitle) Creates an instance of aCloudNetVersionrecord class.- Parameters:
major- the value for themajorrecord componentminor- the value for theminorrecord componentpatch- the value for thepatchrecord componentrevision- the value for therevisionrecord componentversionType- the value for theversionTyperecord componentversionTitle- the value for theversionTitlerecord component
-
-
Method Details
-
fromPackage
Reads and tries to parse the CloudNet version from the information provided by the specified package. This method throws an exception if the given package does not contain valid version information. The version of the package must at least match the semver specification, MAJOR.MINOR.PATCH. If any additional information is supplied this method will try to parse the remaining information from it (revision, version type). The version title is determined by the package implementation title.- Parameters:
source- the package to parse the CloudNet version from.- Returns:
- the parsed CloudNet version instance from the given package.
- Throws:
NullPointerException- if the given package is null.IllegalArgumentException- if the given package doesn't contain parseable data.
-
toString
Converts this version back to a human-readable string. The returned version string always follows the schema:CloudNet <VersionTitle> <major>.<minor>.<patch>-<VersionType> [revision]
The revision is only appended if present (not empty). -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
major
-
minor
-
patch
-
revision
-
versionType
Returns the value of theversionTyperecord component.- Returns:
- the value of the
versionTyperecord component
-
versionTitle
Returns the value of theversionTitlerecord component.- Returns:
- the value of the
versionTitlerecord component
-