org.apache.cassandra.utils

## Class CassandraVersion

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

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

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

  Implements versioning used in Cassandra and CQL.

  Note: The following code uses a slight variation from the semver document (http://semver.org).

- - ### Field Summary

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

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(CassandraVersion other)`
    `boolean` | `equals(java.lang.Object o)`
    `CassandraVersion` | `findSupportingVersion(CassandraVersion... 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(CassandraVersion 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

    - #### CassandraVersion

          public CassandraVersion(java.lang.String version)

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

  - ### Method Detail

    - #### compareTo

          public int compareTo(CassandraVersion other)

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

    - #### findSupportingVersion

          public CassandraVersion findSupportingVersion(CassandraVersion... 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(CassandraVersion 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 © 2018 The Apache Software Foundation