Package net.fabricmc.loader.api
Interface SemanticVersion
- All Superinterfaces:
Comparable<Version>
,Version
Represents a Sematic Version.
Compared to a regular Version
, this type of version receives better support
for version comparisons in dependency notations, and is preferred.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The value of version component that indicates a wildcard. -
Method Summary
Modifier and TypeMethodDescriptiondefault int
Deprecated.Returns the build key in the version notation.Returns the prerelease key in the version notation.int
getVersionComponent
(int pos) Returns the version component atpos
.int
Returns the number of components in this version.boolean
Returns if a wildcard notation is present in this version.static SemanticVersion
Parses a semantic version from a string notation.Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface net.fabricmc.loader.api.Version
getFriendlyString
-
Field Details
-
COMPONENT_WILDCARD
static final int COMPONENT_WILDCARDThe value of version component that indicates a wildcard.- See Also:
-
-
Method Details
-
getVersionComponentCount
int getVersionComponentCount()Returns the number of components in this version.For example,
1.3.x
has 3 components.- Returns:
- the number of components
-
getVersionComponent
int getVersionComponent(int pos) Returns the version component atpos
.May return
COMPONENT_WILDCARD
to indicate a wildcard component.If the pos exceeds the number of components, returns
COMPONENT_WILDCARD
if the version has wildcard; otherwise returns0
.- Parameters:
pos
- the position to check- Returns:
- the version component
-
getPrereleaseKey
Returns the prerelease key in the version notation.The prerelease key is indicated by a
-
before a+
in the version notation.- Returns:
- the optional prerelease key
-
getBuildKey
Returns the build key in the version notation.The build key is indicated by a
+
in the version notation.- Returns:
- the optional build key
-
hasWildcard
boolean hasWildcard()Returns if a wildcard notation is present in this version.A wildcard notation is a
x
,X
, or*
in the version string, such as2.5.*
.- Returns:
- whether this version has a wildcard notation
-
compareTo
Deprecated.Use#compareTo(Version)
instead -
parse
Parses a semantic version from a string notation.- Parameters:
s
- the string notation of the version- Returns:
- the parsed version
- Throws:
VersionParsingException
- if a problem arises during version parsing
-
#compareTo(Version)
instead