Quilt Loader 1
Loading...
Searching...
No Matches
org.quiltmc.loader.api.Version.Semantic Interface Reference

Representation of a semantic version. More...

Inheritance diagram for org.quiltmc.loader.api.Version.Semantic:
org.quiltmc.loader.api.Version org.quiltmc.loader.impl.metadata.qmj.SemanticVersionImpl

Public Member Functions

int versionComponentCount ()
 Returns the number of components in this version.
int versionComponent (int index)
 Returns the version component at pos.
int[] versionComponents ()
default int major ()
 Must be a positive integer.
default int minor ()
 Must be a positive integer.
default int patch ()
 Must be a positive integer.
String preRelease ()
 Returns an empty string if not applicable.
default boolean isPreReleasePresent ()
String buildMetadata ()
 Returns an empty string if not applicable.
int compareTo (Version.Semantic o)
Public Member Functions inherited from org.quiltmc.loader.api.Version
String raw ()
default boolean isSemantic ()
default Semantic semantic ()
int compareTo (Version other)
 If both this and the given version are semantic versions then this compares with the behaviour of Semantic#compareTo(Semantic).

Static Public Member Functions

static Semantic of (String raw) throws VersionFormatException
static Semantic of (int major, int minor, int patch, String preRelease, String buildMetadata) throws VersionFormatException
static Semantic of (int[] components, @Nullable String preRelease, @Nullable String buildMetadata) throws VersionFormatException

Static Public Attributes

static final String EMPTY_BUT_PRESENT_PRERELEASE = new String()
 A special value that represents a preRelease() which is both empty but still present - for example "1.18.0-" (as opposed to "1.18.0", which uses the normal empty string for it's prerelease, due to the missing dash").
Static Public Attributes inherited from org.quiltmc.loader.api.Version
static Comparator< VersionCOMPARATOR = Version::compareTo
 Calls Version#compareTo(Version): this doesn't accept nulls.

Detailed Description

Representation of a semantic version.

Member Function Documentation

◆ buildMetadata()

String org.quiltmc.loader.api.Version.Semantic.buildMetadata ( )

Returns an empty string if not applicable.

Implemented in org.quiltmc.loader.impl.metadata.qmj.SemanticVersionImpl.

◆ isPreReleasePresent()

default boolean org.quiltmc.loader.api.Version.Semantic.isPreReleasePresent ( )
inline
Returns
True if the preRelease() field is present in this version. This is used to differentiate versions with a dash at the end of them (like "1.18.0-", which would return true here), from "1.18.0" (which would return false here.
See also
EMPTY_BUT_PRESENT_PRERELEASE

◆ of()

Semantic org.quiltmc.loader.api.Version.Semantic.of ( String raw) throws VersionFormatException
inlinestatic

◆ preRelease()

String org.quiltmc.loader.api.Version.Semantic.preRelease ( )

Returns an empty string if not applicable.

Implemented in org.quiltmc.loader.impl.metadata.qmj.SemanticVersionImpl.

◆ versionComponent()

int org.quiltmc.loader.api.Version.Semantic.versionComponent ( int index)

Returns the version component at pos.

If pos is greater than or equal to the number of components, then it returns 0.

Parameters
posthe position to check
Returns
the version component

Implemented in org.quiltmc.loader.impl.metadata.qmj.SemanticVersionImpl.

◆ versionComponentCount()

int org.quiltmc.loader.api.Version.Semantic.versionComponentCount ( )

Returns the number of components in this version.

For example, 1.3.x has 3 components.

Returns
the number of components

Implemented in org.quiltmc.loader.impl.metadata.qmj.SemanticVersionImpl.

◆ versionComponents()

int[] org.quiltmc.loader.api.Version.Semantic.versionComponents ( )
Returns
A new array populated with every version component, except for trailing zeros.

Implemented in org.quiltmc.loader.impl.metadata.qmj.SemanticVersionImpl.

Member Data Documentation

◆ EMPTY_BUT_PRESENT_PRERELEASE

final String org.quiltmc.loader.api.Version.Semantic.EMPTY_BUT_PRESENT_PRERELEASE = new String()
static

A special value that represents a preRelease() which is both empty but still present - for example "1.18.0-" (as opposed to "1.18.0", which uses the normal empty string for it's prerelease, due to the missing dash").

You can either compare this to preRelease() using identity to check, or use isPreReleasePresent().

This field exists solely to keep backwards compatibility, since we can't make preRelease() return an Optional.


The documentation for this interface was generated from the following file:
  • src/main/java/org/quiltmc/loader/api/Version.java