Package ca.solostudios.strata.version
Class Version
- java.lang.Object
-
- ca.solostudios.strata.version.Version
-
- All Implemented Interfaces:
Formattable
,java.lang.Comparable<Version>
public final class Version extends java.lang.Object implements java.lang.Comparable<Version>, Formattable
Class representing a version.
-
-
Constructor Summary
Constructors Constructor Description Version(@NotNull CoreVersion coreVersion, @NotNull PreRelease preRelease, @NotNull BuildMetadata buildMetadata)
Constructs a new version with the provided core, pre-release, and build data, values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(@NotNull Version o)
boolean
equals(@Nullable java.lang.Object o)
@NotNull BuildMetadata
getBuildMetadata()
The build metadata.@NotNull CoreVersion
getCoreVersion()
The core version.@NotNull java.lang.String
getFormatted()
This object represented as a short and human readable string.@NotNull java.math.BigInteger
getMajor()
The major version.@NotNull java.math.BigInteger
getMinor()
The minor version.@NotNull java.math.BigInteger
getPatch()
The patch version.@NotNull PreRelease
getPreRelease()
The pre-release version.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Version
@Contract(pure=true) public Version(@NotNull @NotNull CoreVersion coreVersion, @NotNull @NotNull PreRelease preRelease, @NotNull @NotNull BuildMetadata buildMetadata)
Constructs a new version with the provided core, pre-release, and build data, values.- Parameters:
coreVersion
- The core version.preRelease
- The pre-release version.buildMetadata
- The build data.
-
-
Method Detail
-
getMajor
@NotNull @Contract(pure=true) public @NotNull java.math.BigInteger getMajor()
The major version.- Returns:
- The major version.
-
getMinor
@NotNull @Contract(pure=true) public @NotNull java.math.BigInteger getMinor()
The minor version.- Returns:
- The minor version.
-
getPatch
@NotNull @Contract(pure=true) public @NotNull java.math.BigInteger getPatch()
The patch version.- Returns:
- The patch version.
-
getCoreVersion
@NotNull @Contract(pure=true) public @NotNull CoreVersion getCoreVersion()
The core version.- Returns:
- The core version.
-
getPreRelease
@NotNull @Contract(pure=true) public @NotNull PreRelease getPreRelease()
The pre-release version.- Returns:
- The pre-release version.
-
getBuildMetadata
@NotNull @Contract(pure=true) public @NotNull BuildMetadata getBuildMetadata()
The build metadata.- Returns:
- The build metadata.
-
toString
@Contract(pure=true) public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
@Contract(value="null -> false", pure=true) public boolean equals(@Nullable @Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
public int compareTo(@NotNull @NotNull Version o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Version>
-
getFormatted
@NotNull public @NotNull java.lang.String getFormatted()
Description copied from interface:Formattable
This object represented as a short and human readable string.- Specified by:
getFormatted
in interfaceFormattable
- Returns:
- This object as a readable string.
-
-