Package org.apache.solr.util
Class SolrVersion
- java.lang.Object
-
- org.apache.solr.util.SolrVersion
-
- All Implemented Interfaces:
Comparable<SolrVersion>
public final class SolrVersion extends Object implements Comparable<SolrVersion>
Simple Solr version representation backed by a Semantic Versioning library. Provides a constant for current Solr version as well as methods to parse string versions and compare versions to each other.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SolrVersion.InvalidSemVerExpressionException
-
Field Summary
Fields Modifier and Type Field Description static SolrVersion
LATEST
This instance represents the current (latest) version of Solr.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(SolrVersion other)
boolean
equals(Object other)
static SolrVersion
forIntegers(int major, int minor, int patch)
Create a SolrVersion instance from set of integer values.int
getMajorVersion()
int
getMinorVersion()
int
getPatchVersion()
String
getPrereleaseVersion()
boolean
greaterThan(SolrVersion other)
boolean
greaterThanOrEqualTo(SolrVersion other)
int
hashCode()
boolean
lessThan(SolrVersion other)
boolean
lessThanOrEqualTo(SolrVersion other)
boolean
satisfies(String semVerExpression)
Returns true if this version satisfies the provided SemVer ExpressionString
toString()
Return version as plain SemVer string, e.g.static SolrVersion
valueOf(String version)
Create a SolrVersion instance from string value.
-
-
-
Field Detail
-
LATEST
public static final SolrVersion LATEST
This instance represents the current (latest) version of Solr.
-
-
Method Detail
-
valueOf
public static SolrVersion valueOf(String version)
Create a SolrVersion instance from string value. The string must comply to the SemVer spec
-
forIntegers
public static SolrVersion forIntegers(int major, int minor, int patch)
Create a SolrVersion instance from set of integer values. Must comply to the SemVer spec
-
toString
public String toString()
Return version as plain SemVer string, e.g. "9.0.1"
-
greaterThan
public boolean greaterThan(SolrVersion other)
-
greaterThanOrEqualTo
public boolean greaterThanOrEqualTo(SolrVersion other)
-
lessThan
public boolean lessThan(SolrVersion other)
-
lessThanOrEqualTo
public boolean lessThanOrEqualTo(SolrVersion other)
-
satisfies
public boolean satisfies(String semVerExpression)
Returns true if this version satisfies the provided SemVer Expression- Parameters:
semVerExpression
- the expression to test- Throws:
SolrVersion.InvalidSemVerExpressionException
- if the SemVer expression is invalid
-
getMajorVersion
public int getMajorVersion()
-
getMinorVersion
public int getMinorVersion()
-
getPatchVersion
public int getPatchVersion()
-
getPrereleaseVersion
public String getPrereleaseVersion()
-
compareTo
public int compareTo(SolrVersion other)
- Specified by:
compareTo
in interfaceComparable<SolrVersion>
-
-