Package com.day.cq.commons
Class Version
java.lang.Object
com.day.cq.commons.Version
- All Implemented Interfaces:
Comparable<Version>
Implements a version.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionint
Compares this version to the given one, segment by segment with a special "SNAPSHOT" handling.static Version
Creates a new version from the given string.static Version
Creates a new version from version segmentsboolean
String[]
Returns all segments.int
hashCode()
toString()
-
Field Details
-
EMPTY
The empty version
-
-
Method Details
-
create
Creates a new version from the given string.- Parameters:
str
- the version string.- Returns:
- the new version or
EMPTY
ifstr
is an empty string.
-
create
Creates a new version from version segments- Parameters:
segments
- version segments- Returns:
- the new version or
EMPTY
ifsegments
is empty.
-
hashCode
public int hashCode() -
equals
-
toString
-
getNormalizedSegments
Returns all segments.- Returns:
- all segments.
-
compareTo
Compares this version to the given one, segment by segment with a special "SNAPSHOT" handling. Examples:
"1" < "2"
"1.0" < "2"
"2.0.1" < "2.1"
"2.1" < "2.1.1"
"2.1" < "2.1-SNAPSHOT"
"2.1" < "2.1-R1234556"
"2.1-R12345" < "2.1-SNAPSHOT"- Specified by:
compareTo
in interfaceComparable<Version>
- Parameters:
o
- the other version- Returns:
- a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version.
-