java.lang.Object
java.lang.Record
net.luis.utils.util.Version.AppendingVersion
- Record Components:
separator- The separator characterversion- The version number
- All Implemented Interfaces:
Comparable<Version.AppendingVersion>
- Enclosing class:
Version
protected static record Version.AppendingVersion(char separator, int version)
extends Record
implements Comparable<Version.AppendingVersion>
This record represents an appendable version number.
The record is used for the build and suffix version numbers.
The record is used for the build and suffix version numbers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Version.AppendingVersionAn empty appendable version number.
The separator is'\0'and the version is-1.
This is the default value for an empty version number.private final charThe field for theseparatorrecord component.private final intThe field for theversionrecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAppendingVersion(char separator, int version) Creates an instance of aAppendingVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(@NotNull Version.AppendingVersion o) Compares this appendable version number with the given appendable version number.
The comparison is based on the version number, the separator is not considered.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.booleanChecks if the version number is not empty.
The version number is not empty if the separator is not'\0'and the version is not-1.charReturns the value of theseparatorrecord component.toString()Returns a string representation of this record class.intversion()Returns the value of theversionrecord component.
-
Field Details
-
separator
private final char separatorThe field for theseparatorrecord component. -
version
private final int versionThe field for theversionrecord component. -
EMPTY
An empty appendable version number.
The separator is'\0'and the version is-1.
This is the default value for an empty version number.
-
-
Constructor Details
-
Method Details
-
isNotEmpty
public boolean isNotEmpty()Checks if the version number is not empty.
The version number is not empty if the separator is not'\0'and the version is not-1.- Returns:
- True if the version number is not empty, otherwise false
-
compareTo
Compares this appendable version number with the given appendable version number.
The comparison is based on the version number, the separator is not considered.- Specified by:
compareToin interfaceComparable<Version.AppendingVersion>- Parameters:
o- The appendable version to compare with- Returns:
- The comparison result
-
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 '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
separator
public char separator()Returns the value of theseparatorrecord component.- Returns:
- the value of the
separatorrecord component
-
version
public int version()Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-