Class SemanticVersionParser
java.lang.Object
com.norconex.commons.lang.version.SemanticVersionParser
Semantic version string parser. Default parser settings conform to https://semver.org/ specifications. Use available builder options for more lenient parsing.
Max version length
The maximum string length supported by this parser is 255 characters.
Longer strings will throw a SemanticVersionParserException
except when
SemanticVersionParser.SemanticVersionParserBuilder.ignoreLeadingCharacters(boolean) is
true. In such case, it will try parsing longer strings, but
will only consider the last 255 characters.
- Since:
- 3.0.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SemanticVersionParserA relaxed parser with support for optional minor and patch numbers, ignoring leading characters, and ignoring the following suffix strings:.jar,.zip,.exe,.gz,.tgz,.tar, and.tar.gz,static final SemanticVersionParserDefault parser settings, using strict adherence to SemVer specifications.static final SemanticVersionParserSame asSTRICTexcept for ignoring non-numeric leading characters before the version (e.g.,v1.2.3). -
Method Summary
-
Field Details
-
STRICT
Default parser settings, using strict adherence to SemVer specifications. -
LENIENT
A relaxed parser with support for optional minor and patch numbers, ignoring leading characters, and ignoring the following suffix strings:.jar,.zip,.exe,.gz,.tgz,.tar, and.tar.gz, -
TAG
Same asSTRICTexcept for ignoring non-numeric leading characters before the version (e.g.,v1.2.3).
-
-
Method Details
-
parse
Parses a semantic version string.- Parameters:
version- the string to parse- Returns:
- a semantic version instance
- Throws:
SemanticVersionParserException- if the version can't be parsed.
-
builder
-
equals
-
canEqual
-
hashCode
public int hashCode()
-