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 int
compareTo(Version that)
Compares two Versions.boolean
equals(java.lang.Object obj)
boolean
exists()
static Version
fromXML(java.io.InputStream is)
Parses an XML document, looking for a Version element as given by getXML().java.lang.String
getBasicString()
Returns the version like 3.8.1 or 4.0.12-rc3int
getBeta()
int
getBuildNumber()
int
getMajor()
int
getMinor()
int
getRc()
int
getRevision()
java.lang.String
getVerboseString()
Returns the version like 3.8.1 (b1039)java.lang.String
getXML()
int
hashCode()
boolean
isDev()
boolean
isFutureVersion(Version that)
This differs from compareTo in that it only looks at major/minor/rev.boolean
isFutureVersion(java.lang.String s)
Convenience method for scripting.boolean
isSnapshot()
static Version
parse(java.lang.String s)
Creates a version from a string of the format created by Version.toParseableString()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 classjava.lang.String
toString()
-
-
-
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 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.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 interfacejava.lang.Comparable<Version>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-