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 classSolrVersion.InvalidSemVerExpressionException
-
Field Summary
Fields Modifier and Type Field Description static SolrVersionLATESTThis instance represents the current (latest) version of Solr.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SolrVersion other)booleanequals(Object other)static SolrVersionforIntegers(int major, int minor, int patch)Create a SolrVersion instance from set of integer values.intgetMajorVersion()intgetMinorVersion()intgetPatchVersion()StringgetPrereleaseVersion()booleangreaterThan(SolrVersion other)booleangreaterThanOrEqualTo(SolrVersion other)inthashCode()booleanlessThan(SolrVersion other)booleanlessThanOrEqualTo(SolrVersion other)booleansatisfies(String semVerExpression)Returns true if this version satisfies the provided SemVer ExpressionStringtoString()Return version as plain SemVer string, e.g.static SolrVersionvalueOf(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:
compareToin interfaceComparable<SolrVersion>
-
-