Class Version

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Version>

    public class Version
    extends java.lang.Object
    implements java.lang.Comparable<Version>, java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Version()
      Creates a dev version
      Version​(int major, int minor, int rev, int build)  
      Version​(int major, int minor, int rev, int build, int beta, int rc)  
    • Constructor Detail

      • Version

        public Version()
        Creates a dev version
      • Version

        public Version​(int major,
                       int minor,
                       int rev,
                       int build)
      • Version

        public Version​(int major,
                       int minor,
                       int rev,
                       int build,
                       int beta,
                       int rc)
    • Method Detail

      • isDev

        public boolean isDev()
      • isSnapshot

        public boolean isSnapshot()
      • exists

        public boolean exists()
      • getBuildNumber

        public int getBuildNumber()
      • getBeta

        public int getBeta()
      • getRc

        public int getRc()
      • toParseableString

        public java.lang.String toParseableString()
        Returns the version as a compact, parsable (non-XML) string that can be parsed with the 1-string constructor of this class
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getBasicString

        public java.lang.String getBasicString()
        Returns the version like 3.8.1 or 4.0.12-rc3
      • getVerboseString

        public java.lang.String getVerboseString()
        Returns the version like 3.8.1 (b1039)
      • getMajor

        public int getMajor()
      • getMinor

        public int getMinor()
      • getRevision

        public int getRevision()
      • getXML

        public java.lang.String getXML()
      • fromXML

        public static Version fromXML​(java.io.InputStream is)
                               throws org.xml.sax.SAXException,
                                      java.io.IOException
        Parses an XML document, looking for a Version element as given by getXML(). If found, will return a version object corresponding to that version. If no version element is found, null is returned.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • parse

        public static Version parse​(java.lang.String s)
        Creates a version from a string of the format created by Version.toParseableString()
      • isFutureVersion

        public boolean isFutureVersion​(Version that)
        This differs from compareTo in that it only looks at major/minor/rev. Returns true if 'that' is a future major/minor/rev and should not be restored / imported
      • isFutureVersion

        public boolean isFutureVersion​(java.lang.String s)
        Convenience method for scripting.
        Parameters:
        s - String representing a Version
        Returns:
        True if string represents a future major/minor/rev
      • compareTo

        public int compareTo​(Version that)
        Compares two Versions. Note that this comparison is stricter than we want for Gateway restores or project imports. For those, isFutureVersion()
        Specified by:
        compareTo in interface java.lang.Comparable<Version>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object