public class VersionParser extends Object
Version and VersionRange that allows to resolve the minor
and patch value against a configurable list of "latest versions".
For example a parser that is configured with 1.3.7.RELEASE and
1.4.2.RELEASE as latest versions can parse 1.3.x.RELEASE to
1.3.7.RELEASE. Note that the qualifier is important here:
1.3.8.BUILD-SNAPSHOT would be parsed as 1.3.999.BUILD-SNAPSHOT as the
parser doesn't know the latest BUILD-SNAPSHOT in the 1.3.x release
line.
| Modifier and Type | Field and Description |
|---|---|
static VersionParser |
DEFAULT
The default
VersionParser. |
| Constructor and Description |
|---|
VersionParser(List<Version> latestVersions) |
| Modifier and Type | Method and Description |
|---|---|
Version |
parse(String text)
Parse the string representation of a
Version. |
VersionRange |
parseRange(String text)
Parse the string representation of a
VersionRange. |
Version |
safeParse(String text)
Parse safely the specified string representation of a
Version. |
public static final VersionParser DEFAULT
VersionParser.public Version parse(String text)
Version. Throws an
InvalidVersionException if the version could not be parsed.text - the version textInvalidVersionException - if the version text could not be parsedsafeParse(java.lang.String)public Version safeParse(String text)
Version.
Return null if the text represents an invalid version.
text - the version textparse(java.lang.String)public VersionRange parseRange(String text)
VersionRange. Throws an
InvalidVersionException if the range could not be parsed.text - the range textInvalidVersionException - if the range text could not be parsedCopyright © 2022 Pivotal Software, Inc.. All rights reserved.