Package com.avoka.core.util.ver
Class Version
- java.lang.Object
-
- com.avoka.core.util.ver.Version
-
- All Implemented Interfaces:
Comparable<Version>
public class Version extends Object implements Comparable<Version>
Version utility that supports versions in format "a.b.c-qualifier".- Since:
- 17.10.0
-
-
Field Summary
Fields Modifier and Type Field Description static VersionNEW_CORE_SERVICE_VERSIONNew core service version default.static VersionNEW_TEMPL_SERVICE_VERSIONNew template service version default.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version otherVersion)Compares this version with another version object.booleanequals(Object obj)Indicates whether some other object is "equal to" this one.IntegergetMajor()Get the major version numberIntegergetMinor()Get the minor version number.IntegergetPatch()Get the patch version number.StringgetQualifier()Get qualifier.inthashCode()Returns a hash code value for the object.VersionincrMinor()Increment the minor version number and return a new Version object.VersionincrPatch()Increment the patch version number and return a new Version object.StringtoString()Gets to string of this object
-
-
-
Constructor Detail
-
Version
public Version(String version)
Constructs version object by version string. Expected format is "a.b.c-qualifier" no larger than 20 chars.- Parameters:
version- string object in format "a.b.c-qualifier" no larger than 20 chars
-
Version
public Version(Integer major)
Constructs version object by major number. Used for backward compatibility.- Parameters:
major- major version number (should be positive)
-
-
Method Detail
-
getMajor
public Integer getMajor()
Get the major version number- Returns:
- the major version number
-
getMinor
public Integer getMinor()
Get the minor version number.- Returns:
- the minor version number
-
getPatch
public Integer getPatch()
Get the patch version number.- Returns:
- the patch version number
-
getQualifier
public String getQualifier()
Get qualifier.- Returns:
- the qualifier
-
incrMinor
public Version incrMinor()
Increment the minor version number and return a new Version object.- Returns:
- the minor version number and return a new Version object
-
incrPatch
public Version incrPatch()
Increment the patch version number and return a new Version object.- Returns:
- version with incremented patch version number as a new object
-
hashCode
public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided byHashMap.- Overrides:
hashCodein classObject- Returns:
- a hash code value for this object.
- See Also:
Object.equals(java.lang.Object)
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. Implementation relies that the object is of same type and compares its fields.EqualsBuilderin order to return 'true'
-
compareTo
public int compareTo(Version otherVersion)
Compares this version with another version object.- Specified by:
compareToin interfaceComparable<Version>- Parameters:
otherVersion- the version object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
-
-