SemanticVersion (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.utils

## Class SemanticVersion

- java.lang.Object
- - org.apache.cassandra.utils.SemanticVersion

- All Implemented Interfaces:
    java.lang.Comparable<SemanticVersion>

      public class SemanticVersion
      extends java.lang.Object
      implements java.lang.Comparable<SemanticVersion>

  Implements semantic versioning as defined at http://semver.org/. Note: The following code uses a slight variation from the document above in that it doesn't allow dashes in pre-release and build identifier.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `major`
    `int` | `minor`
    `int` | `patch`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SemanticVersion(java.lang.String version)` Parse a semantic version from a string.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(SemanticVersion other)`
    `boolean` | `equals(java.lang.Object o)`
    `SemanticVersion` | `findSupportingVersion(SemanticVersion... versions)` Returns a version that is backward compatible with this version amongst a list of provided version, or null if none can be found.
    `int` | `hashCode()`
    `boolean` | `isSupportedBy(SemanticVersion version)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### major

          public final int major

    - #### minor

          public final int minor

    - #### patch

          public final int patch

  - ### Constructor Detail

    - #### SemanticVersion

          public SemanticVersion(java.lang.String version)

      Parse a semantic version from a string.
      Parameters:
        `version` - the string to parse
      Throws:
        `java.lang.IllegalArgumentException` - if the provided string does not represent a semantic version

  - ### Method Detail

    - #### compareTo

          public int compareTo(SemanticVersion other)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<SemanticVersion>`

    - #### findSupportingVersion

          public SemanticVersion findSupportingVersion(SemanticVersion... versions)

      Returns a version that is backward compatible with this version amongst a list of provided version, or null if none can be found. For instance: "2.0.0".findSupportingVersion("2.0.0", "3.0.0") == "2.0.0" "2.0.0".findSupportingVersion("2.1.3", "3.0.0") == "2.1.3" "2.0.0".findSupportingVersion("3.0.0") == null "2.0.3".findSupportingVersion("2.0.0") == "2.0.0" "2.1.0".findSupportingVersion("2.0.0") == null

    - #### isSupportedBy

          public boolean isSupportedBy(SemanticVersion version)

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2014 The Apache Software Foundation