Class SemVer
- java.lang.Object
-
- com.ellucian.ethos.integration.client.config.SemVer
-
- All Implemented Interfaces:
Comparable<SemVer>
public class SemVer extends Object implements Comparable<SemVer>
The SemVer class holds the semantic version for an Ethos resource. Implements the Comparable interface to enable easy sorting of this class by major/minor/patch values.NOTE: Not all versions of Ethos resources are Semantic versions. Therefore, this class should only be used in support of those versions of resources following Semantic version notation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SemVer.Builder
An inner static Builder class used for building the SemVer object with various criteria.
-
Constructor Summary
Constructors Constructor Description SemVer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(SemVer sv)
Compares this object to the given object, which should also be an instance of this class.boolean
equals(Object o)
Overrides the equals method to compare on the major, minor, and patch values.int
getMajor()
Gets the major version value.int
getMinor()
Gets the minor version value.int
getPatch()
Gets the patch version value.int
hashCode()
Overrides the hashCode to compute and return the hashCode value comprised of the major, minor, and patch values of this class.String
toString()
Returns a string representation of this object containing the SemVer notation of the major.minor.patch values.
-
-
-
Method Detail
-
getMajor
public int getMajor()
Gets the major version value.- Returns:
- The major version value.
-
getMinor
public int getMinor()
Gets the minor version value.- Returns:
- The minor version value.
-
getPatch
public int getPatch()
Gets the patch version value.- Returns:
- The patch version value.
-
compareTo
public int compareTo(SemVer sv)
Compares this object to the given object, which should also be an instance of this class. Compares by the major, then minor, then patch values. Returns the difference between the major, minor, and patch values. If the difference of the major values is 0, then takes the difference of the minor values. If the difference of the minor values is also 0, then it returns the difference of the patch values.- Specified by:
compareTo
in interfaceComparable<SemVer>
- Parameters:
sv
- Another SemVer instance to compare against this one.- Returns:
- A negative value if this SemVer is less than the given SemVer object, a positive value if this SemVer is greater than the given SemVer object, or 0 if they are equal.
-
equals
public boolean equals(Object o)
Overrides the equals method to compare on the major, minor, and patch values.
-
hashCode
public int hashCode()
Overrides the hashCode to compute and return the hashCode value comprised of the major, minor, and patch values of this class.
-
-