java.lang.Object
net.luis.utils.util.Version.Builder
- Enclosing class:
Version
This class represents a builder for a version number.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Version.AppendingVersionThe appendable build version number.private intThe major version number.private intThe minor version number.private intThe patch or fix version number.private StringThe suffix or pre-release identifier.private Version.AppendingVersionThe appendable suffix version number. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBuilder(int major, int minor) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0.privateBuilder(int major, int minor, int patch) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0. -
Method Summary
Modifier and TypeMethodDescription@NotNull Versionbuild()Builds the version with the given version numbers.booleaninthashCode()@NotNull Version.BuilderwithBuild(char separator, int version) Sets the build version number and the separator.
The build version number will be clamped to a minimum of 0.@NotNull Version.BuilderwithMajor(int major) Sets the major version number.
The major version number will be clamped to a minimum of 0.@NotNull Version.BuilderwithMinor(int minor) Sets the minor version number.
The minor version number will be clamped to a minimum of 0.@NotNull Version.BuilderwithPatch(int patch) Sets the patch or fix version number.
The patch or fix version number will be clamped to a minimum of 0.@NotNull Version.BuilderwithSuffix(@Nullable String suffix) Sets the suffix or pre-release identifier.
Removes leading and trailing whitespace from the suffix.
Recommended suffixes are 'alpha', 'beta', 'rc', 'release-candidate', 'release', and 'final'.@NotNull Version.BuilderwithSuffixVersion(int version) Sets the suffix version number.
The suffix version number will be clamped to a minimum of 0.
-
Field Details
-
major
private int majorThe major version number. -
minor
private int minorThe minor version number. -
patch
private int patchThe patch or fix version number. -
build
The appendable build version number. -
suffix
The suffix or pre-release identifier. -
suffixVersion
The appendable suffix version number.
-
-
Constructor Details
-
Builder
private Builder(int major, int minor) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0.- Parameters:
major- The major version numberminor- The minor version number
-
Builder
private Builder(int major, int minor, int patch) Constructs a new version builder with the given version numbers.
The version numbers will be clamped to a minimum of 0.- Parameters:
major- The major version numberminor- The minor version numberpatch- The patch or fix version number
-
-
Method Details
-
withMajor
Sets the major version number.
The major version number will be clamped to a minimum of 0.- Parameters:
major- The major version number- Returns:
- This builder
-
withMinor
Sets the minor version number.
The minor version number will be clamped to a minimum of 0.- Parameters:
minor- The minor version number- Returns:
- This builder
-
withPatch
Sets the patch or fix version number.
The patch or fix version number will be clamped to a minimum of 0.- Parameters:
patch- The patch or fix version number- Returns:
- This builder
-
withBuild
Sets the build version number and the separator.
The build version number will be clamped to a minimum of 0.- Parameters:
separator- The separator character (must be '.', '-', or 'r')version- The build version number- Returns:
- This builder
- Throws:
IllegalArgumentException- If the separator is not '.', '-', or 'r'
-
withSuffix
Sets the suffix or pre-release identifier.
Removes leading and trailing whitespace from the suffix.
Recommended suffixes are 'alpha', 'beta', 'rc', 'release-candidate', 'release', and 'final'.- Parameters:
suffix- The suffix or pre-release identifier- Returns:
- This builder
-
withSuffixVersion
Sets the suffix version number.
The suffix version number will be clamped to a minimum of 0.- Parameters:
version- The suffix version number- Returns:
- This builder
-
build
Builds the version with the given version numbers.- Returns:
- The created version
-
equals
-
hashCode
public int hashCode()
-