com.mysql.cj

## Class ServerVersion

- java.lang.Object
- - com.mysql.cj.ServerVersion

All Implemented Interfaces:
  Comparable<ServerVersion>

    public class ServerVersion
    extends Object
    implements Comparable<ServerVersion>

A server version.

### Field Summary

Fields
`private String` `completeVersion`
`private Integer` `major`
`private Integer` `minor`
`private Integer` `subminor`

### Constructor Summary

Constructors
Constructor and Description
`ServerVersion(int major, int minor, int subminor)`
`ServerVersion(String completeVersion, int major, int minor, int subminor)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo(ServerVersion other)`
`boolean` `equals(Object obj)`
`int` `getMajor()`
`int` `getMinor()`
`int` `getSubminor()`
`int` `hashCode()`
`boolean` `meetsMinimum(ServerVersion min)` Does this version meet the minimum specified by `min'?
`static ServerVersion` `parseVersion(String versionString)` Parse the server version into major/minor/subminor.
`String` `toString()` A string representation of this version.

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

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

### Field Detail

#### completeVersion

    private String completeVersion

#### major

    private Integer major

#### minor

    private Integer minor

#### subminor

    private Integer subminor

### Constructor Detail

#### ServerVersion

    public ServerVersion(String completeVersion,
                         int major,
                         int minor,
                         int subminor)

#### ServerVersion

    public ServerVersion(int major,
                         int minor,
                         int subminor)

### Method Detail

#### getMajor

    public int getMajor()

#### getMinor

    public int getMinor()

#### getSubminor

    public int getSubminor()

#### toString

    public String toString()

A string representation of this version. If this version was parsed from, or provided with, a "complete" string which may contain more than just the version number, this string is returned verbatim. Otherwise, a string representation of the version numbers is given.

Overrides:
  `toString` in class `Object`
Returns:
  string version representation

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### compareTo

    public int compareTo(ServerVersion other)

Specified by:
  `compareTo` in interface `Comparable<ServerVersion>`

#### meetsMinimum

    public boolean meetsMinimum(ServerVersion min)

Does this version meet the minimum specified by `min'?

Parameters:
  `min` - The minimum version to compare against.
Returns:
  true if version meets the minimum specified by `min'

#### parseVersion

    public static ServerVersion parseVersion(String versionString)

Parse the server version into major/minor/subminor.

Parameters:
  `versionString` - string version representation
Returns:
  `ServerVersion`

Copyright © 2016, 2025, Oracle and/or its affiliates.