Class Version
- java.lang.Object
-
- com.inductiveautomation.ignition.common.model.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version that)Compares two Versions.booleanequals(java.lang.Object obj)booleanexists()static VersionfromXML(java.io.InputStream is)Parses an XML document, looking for a Version element as given by getXML().java.lang.StringgetBasicString()Returns the version like 3.8.1 or 4.0.12-rc3intgetBeta()intgetBuildNumber()intgetMajor()intgetMinor()intgetRc()intgetRevision()java.lang.StringgetVerboseString()Returns the version like 3.8.1 (b1039)java.lang.StringgetXML()inthashCode()booleanisDev()booleanisFutureVersion(Version that)This differs from compareTo in that it only looks at major/minor/rev.booleanisFutureVersion(java.lang.String s)Convenience method for scripting.booleanisSnapshot()static Versionparse(java.lang.String s)Creates a version from a string of the format created by Version.toParseableString()java.lang.StringtoParseableString()Returns the version as a compact, parsable (non-XML) string that can be parsed with the 1-string constructor of this classjava.lang.StringtoString()
-
-
-
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:
toStringin classjava.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.SAXExceptionjava.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:
compareToin interfacejava.lang.Comparable<Version>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-