Class CmsModuleVersion

  • All Implemented Interfaces:, java.lang.Comparable<java.lang.Object>

    public class CmsModuleVersion
    extends java.lang.Object
    implements java.lang.Comparable<java.lang.Object>,
    A version number for an OpenCms module.

    A module version number has the form n1.n2.n3.n4. Only n1 is required, n2 - n4 are optional.

    The valid range for each n is 0 - 999. Examples for valid version numbers are 0.9, or 5. The maximum version number is 999.999.999.999.

    The comparison is started with n1 being the most important value, followed by n2 - n4. For example > 4.999.999.999 since 5 > 4.

    For any n1 - n4, if n > 0 leading zeros are ignored. So = Unrequired leading zeros are automatically stripped from version numbers.

    See Also:
    Serialized Form
    • Field Summary

      Modifier and Type Field Description
      static java.lang.String DEFAULT_VERSION
      Default version for new modules.
    • Constructor Summary

      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
      int compareTo​(java.lang.Object obj)  
      boolean equals​(java.lang.Object obj)  
      java.lang.String getVersion()
      Returns the current version String.
      int hashCode()  
      protected void increment()
      Increments this version number by 1 in the last digit.
      protected boolean isUpdated()
      Returns the updated status.
      protected void setUpdated​(boolean updated)
      Sets the updated status.
      void setVersion​(java.lang.String version)
      Sets the version as a String.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CmsModuleVersion

        public CmsModuleVersion​(java.lang.String version)
        Creates a new module version based on a String.

        version - the version to set
    • Method Detail

      • compareTo

        public int compareTo​(java.lang.Object obj)
        Specified by:
        compareTo in interface java.lang.Comparable<java.lang.Object>
        See Also:
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
        See Also:
      • getVersion

        public java.lang.String getVersion()
        Returns the current version String.

        the current version String
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
        See Also:
      • setVersion

        public void setVersion​(java.lang.String version)
        Sets the version as a String.

        version - the version String to set
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
        See Also:
      • increment

        protected void increment()
        Increments this version number by 1 in the last digit.

      • isUpdated

        protected boolean isUpdated()
        Returns the updated status.

        the updated status
      • setUpdated

        protected void setUpdated​(boolean updated)
        Sets the updated status.

        updated - the updated status to set