Record Class Version
java.lang.Object
java.lang.Record
org.springframework.data.elasticsearch.support.Version
A version defined by 3 parts: major minor and revision number.
- Since:
- 4.3
- Author:
- Peter-Josef Meisch
-
Constructor Summary
ConstructorsConstructorDescriptionVersion(int major, int minor, int revision) Creates an instance of aVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static VersionfromString(String s) Creates a version from a String that matchesPATTERN; major, minor and revision numbers separated by dots with optional trailing characters.final inthashCode()Returns a hash code value for this object.intmajor()Returns the value of themajorrecord component.intminor()Returns the value of theminorrecord component.intrevision()Returns the value of therevisionrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Version
public Version(int major, int minor, int revision) Creates an instance of aVersionrecord class.- Parameters:
major- the value for themajorrecord componentminor- the value for theminorrecord componentrevision- the value for therevisionrecord component
-
-
Method Details
-
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. -
fromString
Creates a version from a String that matchesPATTERN; major, minor and revision numbers separated by dots with optional trailing characters. A missing revision is treated as 0.- Parameters:
s- the String to parse- Returns:
- the Version
- Throws:
IllegalArgumentException- if the input is null or cannot be parsed.
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
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
-
revision
public int revision()Returns the value of therevisionrecord component.- Returns:
- the value of the
revisionrecord component
-