Class VersionParser
java.lang.Object
io.spring.initializr.generator.version.VersionParser
Parser for
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.
- Author:
- Stephane Nicoll
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParse the string representation of aVersion
.parseRange
(String text) Parse the string representation of aVersionRange
.Parse safely the specified string representation of aVersion
.
-
Field Details
-
DEFAULT
The defaultVersionParser
.
-
-
Constructor Details
-
VersionParser
-
-
Method Details
-
parse
Parse the string representation of aVersion
. Throws anInvalidVersionException
if the version could not be parsed.- Parameters:
text
- the version text- Returns:
- a Version instance for the specified version text
- Throws:
InvalidVersionException
- if the version text could not be parsed- See Also:
-
safeParse
Parse safely the specified string representation of aVersion
.Return
null
if the text represents an invalid version.- Parameters:
text
- the version text- Returns:
- a Version instance for the specified version text
- See Also:
-
parseRange
Parse the string representation of aVersionRange
. Throws anInvalidVersionException
if the range could not be parsed.- Parameters:
text
- the range text- Returns:
- a VersionRange instance for the specified range text
- Throws:
InvalidVersionException
- if the range text could not be parsed
-