Package org.apache.solr.client.api.util
Class SolrVersion
- java.lang.Object
-
- org.apache.solr.client.api.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.
-
-
Field Summary
Fields Modifier and Type Field Description static SolrVersionLATESTThis instance represents the current (latest) version of Solr.static StringLATEST_STRING
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SolrVersion other)static intcompareVersions(String v1, String v2)Compares two versions v1 and v2.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_STRING
public static final String LATEST_STRING
- See Also:
- Constant Field Values
-
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
-
compareVersions
public static int compareVersions(String v1, String v2)
Compares two versions v1 and v2. Returns negative if v1 isLessThan v2, positive if v1 isGreaterThan v2 and 0 if equal.
-
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
-
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>
-
-