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 Version
NEW_CORE_SERVICE_VERSION
New core service version default.static Version
NEW_TEMPL_SERVICE_VERSION
New template service version default.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Version otherVersion)
Compares this version with another version object.boolean
equals(Object obj)
Indicates whether some other object is "equal to" this one.Integer
getMajor()
Get the major version numberInteger
getMinor()
Get the minor version number.Integer
getPatch()
Get the patch version number.String
getQualifier()
Get qualifier.int
hashCode()
Returns a hash code value for the object.Version
incrMinor()
Increment the minor version number and return a new Version object.Version
incrPatch()
Increment the patch version number and return a new Version object.String
toString()
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:
hashCode
in 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.EqualsBuilder
in order to return 'true'
-
compareTo
public int compareTo(Version otherVersion)
Compares this version with another version object.- Specified by:
compareTo
in 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.
-
-