Package tigase.util
Class Version
- java.lang.Object
-
- tigase.util.Version
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVersion.Builderstatic classVersion.FIELDstatic classVersion.TYPE
-
Field Summary
Fields Modifier and Type Field Description static java.util.EnumSet<Version.FIELD>incrementableFieldsstatic java.util.Comparator<Version>VERSION_COMPARATORstatic VersionZERO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version that)booleanequals(java.lang.Object o)VersiongetBaseVersion()intgetBugfix()intgetBuild()java.lang.StringgetCommit()intgetMajor()intgetMinor()intgetTypeNumber()Version.TYPEgetVersionType()inthashCode()Versionincrement(Version.FIELD field, int amount)Method increments given field by the specified amountbooleanisZero()static Versionof(java.lang.String str)Supports both tigase-server-7.2.0-SNAPSHOT-b4895-dist-max.tar.gz and version stringsjava.lang.StringtoString()java.lang.StringtoString(int padding)
-
-
-
Field Detail
-
incrementableFields
public static final java.util.EnumSet<Version.FIELD> incrementableFields
-
VERSION_COMPARATOR
public static final java.util.Comparator<Version> VERSION_COMPARATOR
-
ZERO
public static final Version ZERO
-
-
Method Detail
-
of
public static Version of(java.lang.String str) throws java.lang.IllegalArgumentException
Supports both tigase-server-7.2.0-SNAPSHOT-b4895-dist-max.tar.gz and version strings- Parameters:
str- string to be parsed. Must match the supported formats- Returns:
- a Version object based on the provided string.
- Throws:
java.lang.IllegalArgumentException- when provided input doesn't match supported formats
-
compareTo
public int compareTo(Version that)
- Specified by:
compareToin interfacejava.lang.Comparable<Version>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
getBaseVersion
public Version getBaseVersion()
-
getBugfix
public int getBugfix()
-
getBuild
public int getBuild()
-
getCommit
public java.lang.String getCommit()
-
getMajor
public int getMajor()
-
getMinor
public int getMinor()
-
getTypeNumber
public int getTypeNumber()
-
getVersionType
public Version.TYPE getVersionType()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
increment
public Version increment(Version.FIELD field, int amount) throws java.lang.IllegalArgumentException
Method increments given field by the specified amount- Parameters:
field- to be incremented - only incrementable fields are supported, i.e. any of theincrementableFields.amount- by which version should be incremented- Returns:
- incremented version if correct field was passed as argument, otherwise same non-incremented version is returned.
- Throws:
java.lang.IllegalArgumentException
-
isZero
public boolean isZero()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(int padding)
-
-