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.AppendingVersion
An 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 char
The field for theseparator
record component.private final int
The field for theversion
record component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AppendingVersion
(char separator, int version) Creates an instance of aAppendingVersion
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(@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.boolean
Indicates whether some other object is "equal to" this one.int
hashCode()
Returns a hash code value for this object.boolean
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
.char
Returns the value of theseparator
record component.toString()
Returns a string representation of this record class.int
version()
Returns the value of theversion
record component.
-
Field Details
-
separator
private final char separatorThe field for theseparator
record component. -
version
private final int versionThe field for theversion
record 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:
compareTo
in 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 theseparator
record component.- Returns:
- the value of the
separator
record component
-
version
public int version()Returns the value of theversion
record component.- Returns:
- the value of the
version
record component
-