Package org.opencms.module
Class CmsModuleVersion
- java.lang.Object
-
- org.opencms.module.CmsModuleVersion
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.lang.Object>
public class CmsModuleVersion extends java.lang.Object implements java.lang.Comparable<java.lang.Object>, java.io.Serializable
A version number for an OpenCms module.A module version number has the form
n1.n2.n3.n4. Onlyn1is required,n2 - n4are optional.The valid range for each
nis 0 - 999. Examples for valid version numbers are0.9,1.0.0.5or5. The maximum version number is999.999.999.999.The comparison is started with
n1being the most important value, followed byn2 - n4. For example5.0.0.1 > 4.999.999.999since5 > 4.For any
n1 - n4, ifn > 0leading zeros are ignored. So001.002.004.004 = 1.2.3.4. Unrequired leading zeros are automatically stripped from version numbers.- Since:
- 6.0.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_VERSIONDefault version for new modules.
-
Constructor Summary
Constructors Constructor Description CmsModuleVersion(java.lang.String version)Creates a new module version based on a String.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(java.lang.Object obj)booleanequals(java.lang.Object obj)java.lang.StringgetVersion()Returns the current version String.inthashCode()protected voidincrement()Increments this version number by 1 in the last digit.protected booleanisUpdated()Returns the updated status.protected voidsetUpdated(boolean updated)Sets the updated status.voidsetVersion(java.lang.String version)Sets the version as a String.java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_VERSION
public static final java.lang.String DEFAULT_VERSION
Default version for new modules.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsModuleVersion
public CmsModuleVersion(java.lang.String version)
Creates a new module version based on a String.- Parameters:
version- the version to set
-
-
Method Detail
-
compareTo
public int compareTo(java.lang.Object obj)
- Specified by:
compareToin interfacejava.lang.Comparable<java.lang.Object>- See Also:
Comparable.compareTo(java.lang.Object)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
getVersion
public java.lang.String getVersion()
Returns the current version String.- Returns:
- the current version String
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
setVersion
public void setVersion(java.lang.String version)
Sets the version as a String.- Parameters:
version- the version String to set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
increment
protected void increment()
Increments this version number by 1 in the last digit.
-
isUpdated
protected boolean isUpdated()
Returns the updated status.- Returns:
- the updated status
-
setUpdated
protected void setUpdated(boolean updated)
Sets the updated status.- Parameters:
updated- the updated status to set
-
-